Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java ActiveMq nonBlockingRedelivery

I am using ActiveMQ version 5.7.x,

I am having one ActiveMQ queue to which the listener listens.

Queue has a ConnectionFactory whose redeliveryPolicy is set to 3, intialRedeliveryDelay set to 5000.

Queue have some good messages and bad messages. While listening to such queue, when bad messages come, they are tried 3 times with the wait time of 5000 millis, but then the good messages are blocked for that much time span.

What I want is, during the wait time of 5000 millis for each retry, the processing of good messages should continue and should not wait for bad message processing.

For this I tried 1 attribute of connectionFactory, i.e. nonBlockingRedelivery set to true.

But nonBlockingRedelivery is not working.

Is there any other way to do this?

like image 781
user3755182 Avatar asked Aug 20 '26 15:08

user3755182


1 Answers

You can always have a retransmission queue for failing messages.

That is, receive messages from a main queue (no redelivery) and if you get an exception, put the message on a redelivery queue.

Let your application listen on both queues and do the same logic to both messages. It should simply be two message listeners invoking the same method. One with redelivery and one without, but with slightly different error handling.

like image 184
Petter Nordlander Avatar answered Aug 23 '26 05:08

Petter Nordlander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!