You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by themitchy <mi...@sophos.com> on 2009/10/22 19:59:09 UTC

How to limit queue by number of messages

I'm looking for a way to keep queue sizes down to a specific number.  For
example if a queue gets to 100000 messages I would like older message to
start disappearing.

I'm aware there are some "Pending Message Limit Strategy" options but these
only apply to pending messages on a topic per consumer.  I'm looking for
something that will limit queue size specifically.
-- 
View this message in context: http://www.nabble.com/How-to-limit-queue-by-number-of-messages-tp26014447p26014447.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to limit queue by number of messages

Posted by bravegag <br...@hotmail.com>.
Hello,

I bumped into this same issue but I know apriori the number of consumers M
that I was going to have so to limit the overall queue size L you configure
the constant size limit X to:

X = L / M; meaning the size you actually want divided by the number of
consumers.

This is a workaround but works for me.

Best regards,
Giovanni


themitchy wrote:
> 
> To be clearer, I'm looking for something like Websphere MQ's maxdepth 
> property for queues.
> 
> themitchy wrote:
>> I'm looking for a way to keep queue sizes down to a specific number.  For
>> example if a queue gets to 100000 messages I would like older message to
>> start disappearing.
>> 
>> I'm aware there are some "Pending Message Limit Strategy" options but
>> these
>> only apply to pending messages on a topic per consumer.  I'm looking for
>> something that will limit queue size specifically.
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-limit-queue-by-number-of-messages-tp26014447p26061476.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to limit queue by number of messages

Posted by Mitch Granger <mi...@sophos.com>.

Dave Stanley wrote:
> I think an EvictionStrategy might work. You can evict least recent or
> most recent messages once your queue gets to a certain size.
> 
> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/MessageEvictionStrategy.html

MessageEvictionStrategy is mentioned in the slow consumer section of the 
website (http://activemq.apache.org/slow-consumer-handling.html in the 
same section as Pending Message Limit Strategy.  I tried the latter and 
it seems to apply to pending messages on a topic for a particular 
consumer rather than pending messages on a queue for any consumer.

I'll give it a try anyways and report back.  It does sound promising, 
thanks for the tip!

> 
> Cheer's,
> /Dave
> 
> On Fri, Oct 23, 2009 at 6:43 AM, Gary Tully <ga...@gmail.com> wrote:
>> Using memory limits or store usage limits with an expiry time are your
>> options for queues at the moment. I think this requirement has been
>> mentioned before, especially for non persistent messages. An internal
>> consumer triggered off the queue size counter could do the necessary. What
>> sort of options would you require w.r.t dealing with discarded messages?
>> What happens in MQ when the maxdepth is reached?
>>
>> Could you raise an enhancement request for this feature?
>>
>> 2009/10/22 Mitch Granger <mi...@sophos.com>
>>
>>> To be clearer, I'm looking for something like Websphere MQ's maxdepth
>>> property for queues.
>>>
>>>
>>> themitchy wrote:
>>>
>>>> I'm looking for a way to keep queue sizes down to a specific number.  For
>>>> example if a queue gets to 100000 messages I would like older message to
>>>> start disappearing.
>>>>
>>>> I'm aware there are some "Pending Message Limit Strategy" options but
>>>> these
>>>> only apply to pending messages on a topic per consumer.  I'm looking for
>>>> something that will limit queue size specifically.
>>>>
>>
>> --
>> http://blog.garytully.com
>>
>> Open Source Integration
>> http://fusesource.com
>>

Re: How to limit queue by number of messages

Posted by Gary Tully <ga...@gmail.com>.
correct. message expiry or time to live, is currently the only option for
queues.

2009/10/29 brett.humphreys <br...@gmail.com>

>
> For what it is worth, I believe in 5.X message eviction strategies are not
> honored by Queues.  TTM's document (listed on the AMQ website) suggests
> otherwise, however empirically speaking and going throughout the code it
> looks like MessageEvictionStrategies are only applicable to
> TopicSubscribers.
> -Brett
>
>
> Dave Stanley wrote:
> >
> > I think an EvictionStrategy might work. You can evict least recent or
> > most recent messages once your queue gets to a certain size.
> >
> >
> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/MessageEvictionStrategy.html
> >
> > Cheer's,
> > /Dave
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-limit-queue-by-number-of-messages-tp26014447p26117765.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: How to limit queue by number of messages

Posted by "brett.humphreys" <br...@gmail.com>.
For what it is worth, I believe in 5.X message eviction strategies are not
honored by Queues.  TTM's document (listed on the AMQ website) suggests
otherwise, however empirically speaking and going throughout the code it
looks like MessageEvictionStrategies are only applicable to
TopicSubscribers.
-Brett


Dave Stanley wrote:
> 
> I think an EvictionStrategy might work. You can evict least recent or
> most recent messages once your queue gets to a certain size.
> 
> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/MessageEvictionStrategy.html
> 
> Cheer's,
> /Dave
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-limit-queue-by-number-of-messages-tp26014447p26117765.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to limit queue by number of messages

Posted by Dave Stanley <ds...@gmail.com>.
I think an EvictionStrategy might work. You can evict least recent or
most recent messages once your queue gets to a certain size.

http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/broker/region/policy/MessageEvictionStrategy.html

Cheer's,
/Dave

On Fri, Oct 23, 2009 at 6:43 AM, Gary Tully <ga...@gmail.com> wrote:
> Using memory limits or store usage limits with an expiry time are your
> options for queues at the moment. I think this requirement has been
> mentioned before, especially for non persistent messages. An internal
> consumer triggered off the queue size counter could do the necessary. What
> sort of options would you require w.r.t dealing with discarded messages?
> What happens in MQ when the maxdepth is reached?
>
> Could you raise an enhancement request for this feature?
>
> 2009/10/22 Mitch Granger <mi...@sophos.com>
>
>> To be clearer, I'm looking for something like Websphere MQ's maxdepth
>> property for queues.
>>
>>
>> themitchy wrote:
>>
>>> I'm looking for a way to keep queue sizes down to a specific number.  For
>>> example if a queue gets to 100000 messages I would like older message to
>>> start disappearing.
>>>
>>> I'm aware there are some "Pending Message Limit Strategy" options but
>>> these
>>> only apply to pending messages on a topic per consumer.  I'm looking for
>>> something that will limit queue size specifically.
>>>
>>
>
>
> --
> http://blog.garytully.com
>
> Open Source Integration
> http://fusesource.com
>

Re: How to limit queue by number of messages

Posted by Gary Tully <ga...@gmail.com>.
Using memory limits or store usage limits with an expiry time are your
options for queues at the moment. I think this requirement has been
mentioned before, especially for non persistent messages. An internal
consumer triggered off the queue size counter could do the necessary. What
sort of options would you require w.r.t dealing with discarded messages?
What happens in MQ when the maxdepth is reached?

Could you raise an enhancement request for this feature?

2009/10/22 Mitch Granger <mi...@sophos.com>

> To be clearer, I'm looking for something like Websphere MQ's maxdepth
> property for queues.
>
>
> themitchy wrote:
>
>> I'm looking for a way to keep queue sizes down to a specific number.  For
>> example if a queue gets to 100000 messages I would like older message to
>> start disappearing.
>>
>> I'm aware there are some "Pending Message Limit Strategy" options but
>> these
>> only apply to pending messages on a topic per consumer.  I'm looking for
>> something that will limit queue size specifically.
>>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: How to limit queue by number of messages

Posted by Mitch Granger <mi...@sophos.com>.
To be clearer, I'm looking for something like Websphere MQ's maxdepth 
property for queues.

themitchy wrote:
> I'm looking for a way to keep queue sizes down to a specific number.  For
> example if a queue gets to 100000 messages I would like older message to
> start disappearing.
> 
> I'm aware there are some "Pending Message Limit Strategy" options but these
> only apply to pending messages on a topic per consumer.  I'm looking for
> something that will limit queue size specifically.