Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does AMQ's redeliver work? Does it hold a consumer completely during the redelivery process?

Tags:

activemq

Assuming that we only have one consumer and our redelivery policy will allow the message to be redelivered for a quite long time.

I've tried a scenario where I sent two messages(different type), one is designed to be redelivered and the other can be consumed normally.

It seems the normal message will be blocked if it is delivered later than the redelivered one. It will not be consumed until the redelivered message has tried many times reaching the maximum redeliver times. That would lead to a situation where a easy-to-consumed message must wait a long time to be consumed..

I'm wondering how the AMQ redeliver work. When a message is redelivered in a consumer, the other message can be sent to this consumer until current message has been consumed or timeout(to DLQ).

Can someone help ? Thanks,

like image 457
Huawei Avatar asked Apr 01 '12 07:04

Huawei


2 Answers

ActiveMQ's overriding concern when redelivering messages is to honour message ordering on a queue.

Given two messages A and B, which get sent to a queue with a defined redelivery policy as you describe: if a client fails processing A, that message will get placed back on the queue and no other messages will be consumed until A is consumed successfully.

Check out the ActiveMQ Message Redelivery and DLQ Handling section for further details.


Please remember to vote this response up if it answers your question.

like image 195
Jakub Korab Avatar answered Oct 15 '22 09:10

Jakub Korab


For this case it is possible to set the ActiveConnectionFactory to onBlockingRedelivery. Find details in de ActiveMq Api documentation:

like image 36
F. Mielke Avatar answered Oct 15 '22 09:10

F. Mielke