RabbitMQ message broker with the delayed message exchange plugin enabled. This allows you to schedule message delivery with a delay.
RabbitMQ message broker with the delayed message exchange plugin enabled. This allows you to schedule message delivery with a delay.
This template deploys RabbitMQ with the rabbitmq_delayed_message_exchange plugin enabled.
http://<service-url>:15672To use the delayed message exchange plugin:
x-delayed-messagex-delayed-type argument to the underlying exchange type (e.g., direct, topic)x-delay header (in milliseconds)Example (Python):
import pika
import json
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
# Declare delayed exchange
channel.exchange_declare(
exchange='delayed_exchange',
exchange_type='x-delayed-message',
arguments={'x-delayed-type': 'direct'}
)
# Publish with 5 second delay
channel.basic_publish(
exchange='delayed_exchange',
routing_key='my_queue',
body=json.dumps({'message': 'Hello'}),
properties=pika.BasicProperties(
headers={'x-delay': 5000} # 5000 milliseconds
)
)
RabbitMQ is licensed under the Mozilla Public License 2.0. See https://github.com/rabbitmq/rabbitmq-server for details.