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:


    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *