You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by zackhasit <za...@gmail.com> on 2012/10/02 16:11:15 UTC

Maintenance Mode

Hi,
     I want to bring down consumers connected to a specific queue for
maintenance via following steps:

1. Block a particular queue from receiving more messages from producers.
(How ?)
2. Check via Console / programatically that all pending messages have been
processed by consumers.
3. Now stop the consumers.

How can I do #1 programatically ? I cant change activemq.xml since that
would require reboot. How to best achieve the above scenario.

Thanks



--
View this message in context: http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Maintenance Mode

Posted by Christian Posta <ch...@gmail.com>.
Well, I was suggesting to do it using a JMX console, like "jconsole" that
comes with the jvm. But, to do programmatically, I don't think there is a
C++ API for JMX.

On Tue, Oct 2, 2012 at 11:34 AM, zackhasit <za...@gmail.com> wrote:

> Excellent! Btw can I do the JMX changes as suggested below via c/c++ or it
> has to be Java ?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353p4657385.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Maintenance Mode

Posted by zackhasit <za...@gmail.com>.
Excellent! Btw can I do the JMX changes as suggested below via c/c++ or it
has to be Java ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353p4657385.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Maintenance Mode

Posted by Christian Posta <ch...@gmail.com>.
Yes, if you're trying to sequentially produce to the list of destinations,
and a producer blocks because the dest it's trying to write to is full,
your whole processing will block. On the other hand, you can set options to
not block the producer and instead send an exception if the destination is
full. That way you can catch the exception for that producer, and continue
on (and possibly re-send at a later point):

See here and the "sendFailIfNoSpace" config option:

http://activemq.apache.org/producer-flow-control.html



On Tue, Oct 2, 2012 at 11:18 AM, zackhasit <za...@gmail.com> wrote:

> Thanks on e last clarification, you said:
> >>Only the producers to that one destination would be blocked, not
> producers
> to all destinations. If a producer is producing to a different destination,
> it will not be blocked.
>
> I am trying to create one process that can write to multiple queues. Does
> this mean that I need to separately multi-thread each producer object in
> the
> process such that if one blocks I can still work on writing to other queues
> ?
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353p4657383.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Maintenance Mode

Posted by zackhasit <za...@gmail.com>.
Thanks on e last clarification, you said:
>>Only the producers to that one destination would be blocked, not producers
to all destinations. If a producer is producing to a different destination,
it will not be blocked.

I am trying to create one process that can write to multiple queues. Does
this mean that I need to separately multi-thread each producer object in the
process such that if one blocks I can still work on writing to other queues
?





--
View this message in context: http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353p4657383.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Maintenance Mode

Posted by Christian Posta <ch...@gmail.com>.
You can change the memory limits via JMX without a restart. JMX allows you
to not only monitor, but interact with the MBeans that are exposed and have
operations and attributes. From within a JMX console, navigate to the
destination in question, find the "MemoryLimit" attribute which denotes
memory in bytes, and change it. Only the producers to that one destination
would be blocked, not producers to all destinations. If a producer is
producing to a different destination, it will not be blocked.

On Tue, Oct 2, 2012 at 9:13 AM, zackhasit <za...@gmail.com> wrote:

> Does memory limit change via JMX require restart ? (I am not familiar with
> JMX but does that allow changes to broker properties also ? I thought it
> was
> just a monitoring interface ... )
>
> Can I set memory limit of a queue to zero such that producers cannot write
> at all while consumers consume all pending messages ? Would that could make
> the queued messages drop down to zero ?
>
> You mentioned about producers blocking until more space is available in a
> queue. However can this be non blocking so that producer can send messages
> to other queues meanwhile? (Note that I am trying to stop consumers for
> maintenance to a particular queue only and broker might have more queues
> that would keep functioning)
>
> This is for non persistent queues.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353p4657377.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



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

Re: Maintenance Mode

Posted by zackhasit <za...@gmail.com>.
Does memory limit change via JMX require restart ? (I am not familiar with
JMX but does that allow changes to broker properties also ? I thought it was
just a monitoring interface ... )

Can I set memory limit of a queue to zero such that producers cannot write
at all while consumers consume all pending messages ? Would that could make
the queued messages drop down to zero ?

You mentioned about producers blocking until more space is available in a
queue. However can this be non blocking so that producer can send messages
to other queues meanwhile? (Note that I am trying to stop consumers for
maintenance to a particular queue only and broker might have more queues
that would keep functioning)

This is for non persistent queues.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353p4657377.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Maintenance Mode

Posted by Gary Tully <ga...@gmail.com>.
hmm, we don't have a good story for that use case atm.

But the memory limit on a destination would be one way to stop message
production.

Via jmx, you could reduce the memoryLimit, say to 1, on a specific
queue and the next message send would block waiting for space.

Via jmx it is possible see the pending/inflight counts for consumers
and the queue depth of your terminating queue.

To terminate a consumer via jmx, you would need to terminate/stop
their connection. you can access the connection via the subscription
view.

For producers, stop/start on their connections is also an option, but
if they use failover they will reconnect.

I presume you are using non persistent messages, if not, calling
broker stop will not result in any message loss.


On 2 October 2012 15:11, zackhasit <za...@gmail.com> wrote:
> Hi,
>      I want to bring down consumers connected to a specific queue for
> maintenance via following steps:
>
> 1. Block a particular queue from receiving more messages from producers.
> (How ?)
> 2. Check via Console / programatically that all pending messages have been
> processed by consumers.
> 3. Now stop the consumers.
>
> How can I do #1 programatically ? I cant change activemq.xml since that
> would require reboot. How to best achieve the above scenario.
>
> Thanks
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Maintenance-Mode-tp4657353.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com