# -*- coding: utf-8 -*-
# @Time    : 2019/8/8 16:40
# @Author  : ZhangYang
# @Email   : ian.zhang.88@outlook.com

import pika

connection = pika.BlockingConnection(
    pika.ConnectionParameters(host='127.0.0.1'))
channel = connection.channel()
channel.queue_declare(queue='hello')

channel.exchange_declare(exchange='my-exchange', exchange_type='x-delayed-message')

message = 'delayed hi!'

header = {'x-delay': 1000}
channel.basic_publish(
        exchange='my-exchange', routing_key='hello',properties=pika.BasicProperties(headers=header), body=message)
print(" [x] Sent :%s" %  (message,))


connection.close()
7b3bb3c4b2375d41e1ed986c1f4bce2da0fc766b
<mask token>

<mask token>
channel.queue_declare(queue='hello')
channel.exchange_declare(exchange='my-exchange', exchange_type=
    'x-delayed-message')
<mask token>
channel.basic_publish(exchange='my-exchange', routing_key='hello',
    properties=pika.BasicProperties(headers=header), body=message)
print(' [x] Sent :%s' % (message,))
connection.close()

<mask token>
connection = pika.BlockingConnection(pika.ConnectionParameters(host=
    '127.0.0.1'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.exchange_declare(exchange='my-exchange', exchange_type=
    'x-delayed-message')
message = 'delayed hi!'
header = {'x-delay': 1000}
channel.basic_publish(exchange='my-exchange', routing_key='hello',
    properties=pika.BasicProperties(headers=header), body=message)
print(' [x] Sent :%s' % (message,))
connection.close()

import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(host=
    '127.0.0.1'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.exchange_declare(exchange='my-exchange', exchange_type=
    'x-delayed-message')
message = 'delayed hi!'
header = {'x-delay': 1000}
channel.basic_publish(exchange='my-exchange', routing_key='hello',
    properties=pika.BasicProperties(headers=header), body=message)
print(' [x] Sent :%s' % (message,))
connection.close()

# -*- coding: utf-8 -*-
# @Time    : 2019/8/8 16:40
# @Author  : ZhangYang
# @Email   : ian.zhang.88@outlook.com

import pika

connection = pika.BlockingConnection(
    pika.ConnectionParameters(host='127.0.0.1'))
channel = connection.channel()
channel.queue_declare(queue='hello')

channel.exchange_declare(exchange='my-exchange', exchange_type='x-delayed-message')

message = 'delayed hi!'

header = {'x-delay': 1000}
channel.basic_publish(
        exchange='my-exchange', routing_key='hello',properties=pika.BasicProperties(headers=header), body=message)
print(" [x] Sent :%s" %  (message,))


connection.close()