If you are just looking to trash old messages then use the timeToLive setting 
when producing messages on the DLQ.
https://camel.apache.org/components/4.10.x/eips/message-expiration.html

If you want a manually triggered process, then you can create a consumer 
application that consumes X number of messages, where X is specified on startup.
--
Alex

-----Original Message-----
From: Ephemeris Lappis <ephemeris.lap...@gmail.com> 
Sent: Tuesday, March 11, 2025 9:07 AM
To: us...@camel.apache.org; users@activemq.apache.org
Subject: [EXTERNAL SENDER:] Camel JMS consumer with dynamic selector to read 
ActiveMQ DLQueues

Hello.

I'm looking for a simple way to clean DLQ queues on our ActiveMQ brokers.
Messages are moved to DLQ queues when some unexpected conditions lead consumers 
to fail. We've no automatic processing for DLQ messages that are only needed 
for diagnosis. Nevertheless, when the queues contain too many messages, the 
ActiveMQ console or alternative browsing tools are not able to handle them, 
and, by the way, thousands of messages are useless. This is why we're looking 
for a periodic cleaning. For example, we could remove all messages that are 
older than N days.

A JMS selector can be used to check the JMSTimestamp is before a given time. 
But I can't find any way to write a route with a JMS 'from' statement that 
could evaluate something like : JMSTimestamp < NOW() - INTERVAL '7 days'...

I imagine that more complex solutions could be considered, consuming all the 
DLQ queues messages, and moving them to other queues with an expiration time, 
setting a policy to delete expired messages. But this is not our first choice...

I've also searched for a way to force ActiveMQ to set an expiration time on all 
DLQ messages, but It seems it's not possible.

Any ideas are welcome !

Thanks in advance.

Regards.

*************************** IMPORTANT NOTE*****************************
The opinions expressed in this message and/or any attachments are those of the 
author and not necessarily those of Brown Brothers Harriman & Co., its 
subsidiaries and affiliates ("BBH"). There is no guarantee that this message is 
either private or confidential, and it may have been altered by unauthorized 
sources without your or our knowledge. Nothing in the message is capable or 
intended to create any legally binding obligations on either party and it is 
not intended to provide legal advice. BBH accepts no responsibility for loss or 
damage from its use, including damage from virus.
******************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@activemq.apache.org
For additional commands, e-mail: users-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to