On Thu, Jul 23, 2009 at 3:28 PM, Wxman<mark.fenb...@noaa.gov> wrote:
>
> Hi,
>
> My app receives messages that are persisted in the ActiveMQ message store.
> This is good except I want to have some control over how many back messages
> my app receives.  Any messages older than a specific time are useless.  I
> want ActiveMQ to deliver only the messages since a specific time.  In
> addition, I want ActiveMQ to only hang on to persisted messages for X hours
> before releasing them.  How do I do either of these?
>
> As it is now, it appears ActiveMQ hangs onto them for a very long time, and
> when I start my app, it immediately receives an ever-growing number of
> messages, which will soon bog down my program...

There are a couple of ways to restrict message delivery based on an
amount of time:

1) Set the message expiration via the MessageProducer.setTimeToLive()
method. This will set the duration of time in milliseconds that a
message should be retained by the broker before being expired. Expired
messages are not delivered to consumers.

2) Use an eviction policy to dispose of messages in broker. More info
on eviction policies is available here:

http://activemq.apache.org/slow-consumer-handling.html

As far as instructing ActiveMQ to persist messages for a given amount
of time, this is not something that's configurable. Persistent
messages are held on to by the broker until they're delivered. Upon
successful delivery, they are then marked for disposal from the
persistent store and are then disposed via a separate thread on a
timed interval (IIRC, it runs every five minutes).

Bruce
-- 
perl -e 'print 
unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

ActiveMQ in Action: http://bit.ly/2je6cQ
Blog: http://bruceblog.org/
Twitter: http://twitter.com/brucesnyder

Reply via email to