Reading JMS message and sending queue acknowledgement on demand
I have a scenario where I need to do a request-response with the JMS Queue, but on a specific condition. 1. I have two processes that need to run at specific by different time of the day ? For instance Process 1 at 4:00 PM and Process 2 at 12:00 PM. 2. Both these processes are attached to a single Consumer, which intern is listening on an Active MQ queue. 3. This Queue contains data that is required by both these processes, but whenever they run. The approach we are trying to go with here is that we trigger the Consumer process at the time when each of the process need to run and consume the messages at that time (For Example: Process 2 at 12:00 PM). However, the other process also needs to run and consume the same message (For Example: Process 1 at 4:00 PM). To do this, we need to acknowledge the queue explicitly for every data so that the data gets deleted from the queue, only when each of these processes consume the data. Following are the questions I have around it. 1. If I use cJMS in the route, is there a way to start the process in on a schedule. As per my understanding, cJMS will keep listening to the queue as soon as the route is started. What are my other options to make it work according to schedule? 2. How do I acknowledge the queue? I am sure that I will need to use Client_Acknowledge as Acknowledgement Mode, but I could not find a component where I could acknowledge the queue on condition. 3. If there is no component I can use to acknowledge, how can I get the javax.jms.Message object from my JMS, so I can do message.acknowledge() explicitly.