You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by rjj <Ri...@directline.com> on 2007/05/23 18:39:48 UTC

Can you delay consuming messages on a queue by the date time?

Hi,
Can you delay consuming messages on a queue by the date time?

I would like to place a message on a queue but not have it consumed until a
certain time in the system is reached in the future. Say for example 5 mins
into the future.

I do not want to hold onto the message for 5 mins before sending say in a
thread.sleep method and then send it for consuming. I require the message to
be already sent and placed on the queue. Until it reached it's delivery time
and then was consumed.

Is this possible with ActiveMQ?
And if so, would it require a persistent messaging store?

Thanks.
-- 
View this message in context: http://www.nabble.com/Can-you-delay-consuming-messages-on-a-queue-by-the-date-time--tf3805186s2354.html#a10767896
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Can you delay consuming messages on a queue by the date time?

Posted by James Strachan <ja...@gmail.com>.
On 5/23/07, rjj <Ri...@directline.com> wrote:
> Hi,
> Can you delay consuming messages on a queue by the date time?

Its a feature requested but we've not yet implemented it...
http://issues.apache.org/activemq/browse/AMQ-451


> I would like to place a message on a queue but not have it consumed until a
> certain time in the system is reached in the future. Say for example 5 mins
> into the future.

You can place it on the queue, then you could create a consumer in 5
minutes time to consume it but its not ideal.

To consume '5 minutes old' messages, you could use a selector to
filter old-enough messages; then every (say) minute close & recreate
the consumer with a new selector.

Or you could use something like this to poll from the queue
http://activemq.apache.org/camel/quartz.html

-- 
James
-------
http://macstrac.blogspot.com/

Re: Can you delay consuming messages on a queue by the date time?

Posted by James Strachan <ja...@gmail.com>.
On 5/23/07, rjj <Ri...@directline.com> wrote:
>
> Hi,
> Can you delay consuming messages on a queue by the date time?
>
> I would like to place a message on a queue but not have it consumed until a
> certain time in the system is reached in the future. Say for example 5 mins
> into the future.
>
> I do not want to hold onto the message for 5 mins before sending say in a
> thread.sleep method and then send it for consuming. I require the message to
> be already sent and placed on the queue. Until it reached it's delivery time
> and then was consumed.

This is now possible using the Delayer pattern in Camel...
http://activemq.apache.org/camel/delayer.html

either delay based on the JMSTimestamp - or add your own custom header
for the delivery time.

-- 
James
-------
http://macstrac.blogspot.com/