Gagan Arora
Gagan Arora

Reputation: 96

ActiveMQ - A message sent to multiple queues is getting stuck in queues if exception occurs in any queue

I'm am using Virtual Destinations to implement Publish Subscribe model in ActiveMQ 5.15.13.

I've a virtual topic VirtualTopic and there are two queues bound to it. Each queue has it's own redelivery policy. Let's say Queue 1 will retry message 2 times in case there is an exception while processing the message and Queue 2 will retry message 3 times. Post retry message will be sent to deadletter queue.

I've observed that when a message is sent to VirtualTopic, it is delivered to both the queues. I'm facing an issue where if the consumers of both queues are not able to process the message successfully. The message destined for Queue 1 is moved to deadletter queue after retrying for 2 times. My expectation is that message in Queue 2 would be deadlettered after 3 retries. But the message is retried to consumer of Queue 2 only for 2 times and then is stuck in Queue 2 as pending message.

There is no specific configuration I've done in activemq broker and the redelivery policy is applied programmatically. Is there any configuration I'm missing?

Upvotes: 2

Views: 248

Answers (1)

Gagan Arora
Gagan Arora

Reputation: 96

The problem was in my implementation as for queue2, a new factory instance was created and redelivery policy was not getting setup correctly. The default redelivery policy (max redeliveries=6, with some delay) kicked in which caused delay in redelivered message. I was testing the behaviour using junit test cases and the consumer died as soon as test case was finished but message was still pending for redeliveries.

Upvotes: 1

Related Questions