Your cart is currently empty!
RabbitMQ: Delaying Message
Create a queue named delay with these parameters:
- x-message-ttl = 5000 (5 seconds)
- x-dead-letter-exchange = ” (empty string)
- x-dead-letter-routing-key = ‘execute’ (name of the queue you want to send this message to after 5 seconds delay)
channel.assertQueue('delay', { durable: true, arguments: { 'x-message-ttl': 5000, 'x-dead-letter-exchange': '', 'x-dead-letter-routing-key': 'execute' } })
Then create a queue named execute to process the message.
References:
- https://www.rabbitmq.com/blog/2014/01/23/preventing-unbounded-buffers-with-rabbitmq#per-queue-message-ttl
- https://www.rabbitmq.com/docs/dlx
- https://www.cloudamqp.com/docs/delayed-messages.html
- https://amqp-node.github.io/amqplib/channel_api.html#channel_assertQueue
- https://medium.com/@shivanksingh01/rabbitmq-dead-letter-exchange-a-comprehensive-guide-node-js-b62967a76f10
Leave a Reply