Reputation: 1936
I have defined a Route
which consumes messages from a queue without any problems, and right now I am trying to consume the messages that have been in the queue for 12 hours, I got the idea to use a selector
, but no idea how to use it with JMSTimestamp
to meet the 12 hours criteria.
This is the Route
:
<route id="INBOUND.RECEIVE.IN">
<from
uri="activemq:queue:QXL.INBOUND.RECEIVE.IN?selector=JMSTimestamp%3D${date.time}&concurrentConsumers=10&destination.consumer.prefetchSize=0&deliveryPersistent=true&username=admin01&password=001!admin01001!" />
<pipeline>
<bean method="inboundReceive" ref="logipalServices"/>
</pipeline>
</route>
And this is the date bean
<bean id="date" class="java.util.Date" scope="prototype"/>
Upvotes: 2
Views: 983
Reputation: 4558
Based on your explanation, I think something is wrong with your selector.
JMSTimestamp%3D${date.time}
means JMSTimestamp = ${date.time}
It means you're looking for all messages with the exact JMSTimestamp
. Since Date.getTime()
returns time in milliseconds, it's very unlikely, you will retrieve any message from the queue.
I think you should try something like :
JMSTimestamp > current date - 12 hours (pseudo code for selector)
I hope this will help you.
Upvotes: 1