How to automatically remove messages from DLQ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to automatically remove messages from DLQ?

Ishitori
I have a queue where I store messages without expiration time. A consumer process messages, but it is okay that it can't successfully process them from the first try. If processing failed I resend message to the same queue with a delayed delivery (using scheduler). If a message can't be processed after 5 tries I send it to a queue with a "DLQ.' prefix. So I create DLQ by myself via sending messages to queue with the name "DLQ.<initial_queue_name>"

I want to save messages in "DLQ." for monitoring reasons, but I want to store only "fresh" unprocessed messages. Can I configure broker in the way so it would automatically delete messages from that DLQ which are older than 15 days?
Reply | Threaded
Open this post in threaded view
|

Re: How to automatically remove messages from DLQ?

dejanb
You should put expiration time on the messages sent to the DLQ. BTW you
don't need to handle redelivery and DLQ manually, broker can do that for you

http://activemq.apache.org/message-redelivery-and-dlq-handling.html


Regards
--
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Fri, Jan 20, 2012 at 1:46 PM, Ishitori <[hidden email]> wrote:

> I have a queue where I store messages without expiration time. A consumer
> process messages, but it is okay that it can't successfully process them
> from the first try. If processing failed I resend message to the same queue
> with a delayed delivery (using scheduler). If a message can't be processed
> after 5 tries I send it to a queue with a "DLQ.' prefix. So I create DLQ by
> myself via sending messages to queue with the name
> "DLQ.<initial_queue_name>"
>
> I want to save messages in "DLQ." for monitoring reasons, but I want to
> store only "fresh" unprocessed messages. Can I configure broker in the way
> so it would automatically delete messages from that DLQ which are older
> than
> 15 days?
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-automatically-remove-messages-from-DLQ-tp4313129p4313129.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: How to automatically remove messages from DLQ?

Ishitori
Thanks! Yeah, I thought about that. Okay I will set expiration time.

Well, redelivery policy is working not as good as I supposed it to work. First of all, it blocks consumer to receive other messages until redelivery policy time reached. If you apply patch that makes consumer non-blocking then you might end up with a lot of threads being run. If, as it is in my case, you might have lots of messages unprocessed at the same time, then it is a bad solution. So I ended up with manual resending messages to the same queue with setting appropriate delivery delay if there still tries left. I had to manually calculate these delays, based on the same settings as ActiveMQ.NMS does. It allows me to unblock the consumer instantly and at the same time broker is responsible for redelivering messages.