Reputation: 357
I am using RabbitMq really amazing message broker, but what i need is to have long message back up time in the queue. So that if a message is not reached to certain consumers who were inactive at that time and they are active after few mins eventually the message should be delivered to the respective consumer through fanout exchange.
What i tried is i had increased TTL in queue. Whether it is the correct way or some other tricks can be done?
Thanks in advance
Upvotes: 4
Views: 1124
Reputation: 22682
You could try to use a queue with x-message-ttl
, and x-dead-letter-exchange
args.put("x-message-ttl", 10000);
args.put("x-dead-letter-exchange",exchange_dead_letter);
channel.queueDeclare(queue, false, false, false, args);
x-dead-letter-exchange
is an exchange and if the message is expired by the TTL time, the message is redirect to the x-dead-letter-exchange
.
Then you can handle the message as you prefer. You can find more detail here: http://www.rabbitmq.com/dlx.html.
Upvotes: 2