Background
At a high level, I have a Java application in which certain events must trigger a specific action for the current user. However, events can be very frequent, and the action is always the same. Therefore, when the first event occurs, I would like to plan an action at some point in the near future (for example, 5 minutes). During this period of time, subsequent events should not take any action because the application sees that an action has already been scheduled. After completing the planned action, we will return to step 1, and the next event will start the cycle again.
My idea is to implement this filtering and throttling mechanism by embedding an ActiveMQ instance in memory within the application itself (I don't care about saving the queue).
I believe that JMS 2.0 supports this concept of delivery delay, with the delay of messages sitting in the "queue queue" until the time of delivery to the real destination. However, I also believe that ActiveMQ does not yet support the JMS 2.0 specification ... so I am thinking of simulating the same behavior using lifetime values โโ(TTL) and message queue processing (DLQ).
Basically, my message producer code puts messages in a fictitious intermediate queue from which consumers never pull anything . Messages will be posted with a 5-minute TTL value, and upon expiration ActiveMQ will display them in DLQ. This is the queue from which users of my message will actually consume messages.
Question
I donโt think I want to actually consume from DLQ by default, because I have no idea what other internal ActiveMQ things can dump there that are completely unrelated to my application code. Therefore, I think it would be better if my dummy intermediate queue had its own DLQ. I saw only one page of ActiveMQ documentation that discusses DLQ configuration , and it only processes XML configuration files for a standalone ActiveMQ installation (and not the -memory broker built into the application).
Is it possible to programmatically configure a custom DLQ at run time for a queue in an embedded ActiveMQ instance?
I will also be interested to hear alternative suggestions if you think I'm wrong. I am more familiar with JMS than AMQP, so I donโt know if it has become much easier with Qpid or any other AMQP browser implemented in Java. Whatever Apache Camel (!) Is, I believe that it should succeed in such things, but this learning curve may be gross redundant for this use case.