Your cart is currently empty!
RabbitMQ: Alternate Exchange
Alternate Exchange is used to catch “unrouted” message.
- Create an exchange called dlx with the type fanout. We choose fanout to catch any routing keys.
- Create a queue called dlq and bind it with dlx.
- Create an exchange called foo and set it’s alternate_exchange = dlx.
- Send message to foo. Since foo is not bound with any queue, by default, the message is lost. But since we set the alternate_exchange in step 3, the message is sent to dlx which after that redirected to dlq.
channel.assertExchange('foo', 'fanout', { alternateExchange: 'dlx' })
References:
Leave a Reply