You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jamie <ja...@mailarchiva.com> on 2013/08/09 16:48:19 UTC

block on threshold

Hi All

Greetings! Does anyone have any idea on how to implement producer 
blocking in ActiveMQ when the no. of queued messages gets to a certain 
threshold? I've read about Active MQ's flow control feature, but I am 
still confused on how one would accomplish this. In short, when the 
number of messages gets to say 10,000 messages, I wish for the producers 
to block. I am using ActiveMQ in embedded mode, so any clues from an API 
perspective would be most appreciated.

Much appreciate your guidance

Thanks

Jamie


Re: block on threshold

Posted by Christian Posta <ch...@gmail.com>.
Producer Flow Control is implemented based on message size limits, not
message counts. So you could calculate an approximate message size from the
expected number of messages you wish to have as a backlog, and set the
configurations like that.

So if you have 10,000 1K messages, you can set your queue to have a memory
limit of ~ 9.76MB

You will have to play around with it a bit because the actual message size
includes headers, and other JMS stuff, so it won't be 100% exact.

Hope that helps


On Fri, Aug 9, 2013 at 7:48 AM, Jamie <ja...@mailarchiva.com> wrote:

> Hi All
>
> Greetings! Does anyone have any idea on how to implement producer blocking
> in ActiveMQ when the no. of queued messages gets to a certain threshold?
> I've read about Active MQ's flow control feature, but I am still confused
> on how one would accomplish this. In short, when the number of messages
> gets to say 10,000 messages, I wish for the producers to block. I am using
> ActiveMQ in embedded mode, so any clues from an API perspective would be
> most appreciated.
>
> Much appreciate your guidance
>
> Thanks
>
> Jamie
>
>


-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta