EJB programming & troubleshooting: Getting messages from queue after specific period of time
Hello Can anybody give advice about accomplishing following requirement in handling message from queue? Requirement: Message is sent to queue by the producer with some time information (in header or may be message property). This information tells container that it should pick MDB for the message processing only after the specified amount of time is passed (after message arrival). Ex: message arrives to queue at time X, with the time 5000 milliseconds. Message waits 5 seconds in queue and started being processed at time X + 5000.
- Posted by: Sergey Gus
- Posted on: January 12 2010 10:25 EST
- Getting messages from queue after specific period of time by Sergey Gus on January 12 2010 10:39 EST
- Re: Getting messages from queue after specific period of time by Sergey Gus on January 13 2010 03:27 EST
- Getting messages from queue after specific period of time by Karo Silimi Desenli karo Çini on March 07 2013 03:56 EST
In other words required implementation similar to java.util.concurrent.DelayQueue - A queue of elements, in which an element can only be taken when its delay has expired.
I've searched the forum and found that there already exists discussion with same topic: http://www.theserverside.com/discussions/thread.tss?thread_id=41364 It suggests using server specific property. For JBoss: jmsMsg.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", timeToDeliver); Another question arises: does anybody know how the delivery is accomplished internally by the server? I mean whether the message is sent immediately after queueSender.send(jmsMsg); and then picked up from queue at specified time or whether the message is sent to queue at the specified time?