You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Wxman <Ma...@noaa.gov> on 2009/07/23 23:28:59 UTC
Clearing the message store
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...
Wxman
--
View this message in context: http://www.nabble.com/Clearing-the-message-store-tp24634974p24634974.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Clearing the message store
Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Jul 23, 2009 at 3:28 PM, Wxman<Ma...@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)U8V4\@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