You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Roger Hoover <ro...@gmail.com> on 2007/11/01 18:57:38 UTC

Is it possible to suspend and resume message delivery for broker?

While rolling out new consumer code, we'd like to suspend the broker
so that messages can be enqueued but not delivered.  Once we've pushed
the new code out and restarted the consumers, we want to resume
message delivery.

Is this possible with ActiveMQ?

Any advice/info is appreciated.  Thanks,

Roger

Re: Is it possible to suspend and resume message delivery for broker?

Posted by tpounds <tr...@gmail.com>.
no problem I hope it works out for you

-Trevor


Roger Hoover wrote:
> 
> Interesting idea.  Thanks, Trevor.
> 
> On 11/1/07, tpounds <tr...@gmail.com> wrote:
>>
>> If your broker is forwarding to another broker similar to a network of
>> brokers configuration you could stop the network connector between them
>> temporarily via JMX.  The configuration could be similar to the
>> following:
>>
>> Before Connector Stop:
>>
>> (Producer) -> (Broker 1) -> (Broker 2) -> (Consumer)
>>
>> After Connector Stop:
>>
>> (Producer) -> (Broker 1) XXLink DownXX (Broker 2) -> (Consumer)
>>
>> At this point you would do your upgrade procedure on the consumer. Then
>> start the downed link back up.  What this would effectively accomplish is
>> queuing all the messages on broker 1 until the link between broker 1 and
>> broker 2 has been reestablished.
>>
>> -Trevor
>>
>>
>> Roger Hoover wrote:
>> >
>> > Stopping the consumers involves sending SIGTERM to them which could
>> > kill them in the middle of processing a message.  Being able to
>> > suspend delivery would allow us to make sure they were no longer
>> > processing messages before we kill them.  Granted, we can get around
>> > this problem by retrofitting the code to handle SIGTERM appropriately
>> > but this would have been the easier approach.
>> >
>> > However, there may be other use cases for a "suspend delivery" feature.
>> >
>> > On 11/1/07, James Strachan <ja...@gmail.com> wrote:
>> >> On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
>> >> > While rolling out new consumer code, we'd like to suspend the broker
>> >> > so that messages can be enqueued but not delivered.  Once we've
>> pushed
>> >> > the new code out and restarted the consumers, we want to resume
>> >> > message delivery.
>> >> >
>> >> > Is this possible with ActiveMQ?
>> >> >
>> >> > Any advice/info is appreciated.  Thanks,
>> >>
>> >> Why not just stop the consumers, redeploy the code and restart them?
>> >>
>> >> --
>> >> James
>> >> -------
>> >> http://macstrac.blogspot.com/
>> >>
>> >> Open Source SOA
>> >> http://open.iona.com
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-it-possible-to-suspend-and-resume-message-delivery-for-broker--tf4733097s2354.html#a13538863
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-it-possible-to-suspend-and-resume-message-delivery-for-broker--tf4733097s2354.html#a13541583
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Is it possible to suspend and resume message delivery for broker?

Posted by Roger Hoover <ro...@gmail.com>.
Interesting idea.  Thanks, Trevor.

On 11/1/07, tpounds <tr...@gmail.com> wrote:
>
> If your broker is forwarding to another broker similar to a network of
> brokers configuration you could stop the network connector between them
> temporarily via JMX.  The configuration could be similar to the following:
>
> Before Connector Stop:
>
> (Producer) -> (Broker 1) -> (Broker 2) -> (Consumer)
>
> After Connector Stop:
>
> (Producer) -> (Broker 1) XXLink DownXX (Broker 2) -> (Consumer)
>
> At this point you would do your upgrade procedure on the consumer. Then
> start the downed link back up.  What this would effectively accomplish is
> queuing all the messages on broker 1 until the link between broker 1 and
> broker 2 has been reestablished.
>
> -Trevor
>
>
> Roger Hoover wrote:
> >
> > Stopping the consumers involves sending SIGTERM to them which could
> > kill them in the middle of processing a message.  Being able to
> > suspend delivery would allow us to make sure they were no longer
> > processing messages before we kill them.  Granted, we can get around
> > this problem by retrofitting the code to handle SIGTERM appropriately
> > but this would have been the easier approach.
> >
> > However, there may be other use cases for a "suspend delivery" feature.
> >
> > On 11/1/07, James Strachan <ja...@gmail.com> wrote:
> >> On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
> >> > While rolling out new consumer code, we'd like to suspend the broker
> >> > so that messages can be enqueued but not delivered.  Once we've pushed
> >> > the new code out and restarted the consumers, we want to resume
> >> > message delivery.
> >> >
> >> > Is this possible with ActiveMQ?
> >> >
> >> > Any advice/info is appreciated.  Thanks,
> >>
> >> Why not just stop the consumers, redeploy the code and restart them?
> >>
> >> --
> >> James
> >> -------
> >> http://macstrac.blogspot.com/
> >>
> >> Open Source SOA
> >> http://open.iona.com
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Is-it-possible-to-suspend-and-resume-message-delivery-for-broker--tf4733097s2354.html#a13538863
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Is it possible to suspend and resume message delivery for broker?

Posted by tpounds <tr...@gmail.com>.
If your broker is forwarding to another broker similar to a network of
brokers configuration you could stop the network connector between them
temporarily via JMX.  The configuration could be similar to the following:

Before Connector Stop:

(Producer) -> (Broker 1) -> (Broker 2) -> (Consumer)

After Connector Stop:

(Producer) -> (Broker 1) XXLink DownXX (Broker 2) -> (Consumer)

At this point you would do your upgrade procedure on the consumer. Then
start the downed link back up.  What this would effectively accomplish is
queuing all the messages on broker 1 until the link between broker 1 and
broker 2 has been reestablished.

-Trevor


Roger Hoover wrote:
> 
> Stopping the consumers involves sending SIGTERM to them which could
> kill them in the middle of processing a message.  Being able to
> suspend delivery would allow us to make sure they were no longer
> processing messages before we kill them.  Granted, we can get around
> this problem by retrofitting the code to handle SIGTERM appropriately
> but this would have been the easier approach.
> 
> However, there may be other use cases for a "suspend delivery" feature.
> 
> On 11/1/07, James Strachan <ja...@gmail.com> wrote:
>> On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
>> > While rolling out new consumer code, we'd like to suspend the broker
>> > so that messages can be enqueued but not delivered.  Once we've pushed
>> > the new code out and restarted the consumers, we want to resume
>> > message delivery.
>> >
>> > Is this possible with ActiveMQ?
>> >
>> > Any advice/info is appreciated.  Thanks,
>>
>> Why not just stop the consumers, redeploy the code and restart them?
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source SOA
>> http://open.iona.com
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-it-possible-to-suspend-and-resume-message-delivery-for-broker--tf4733097s2354.html#a13538863
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Is it possible to suspend and resume message delivery for broker?

Posted by Roger Hoover <ro...@gmail.com>.
I think the consumers will keep reconnecting so I'm not sure this will
work but will give it a try.

On 11/1/07, Diego Botticelli <di...@gmail.com> wrote:
>
> Maybe you could, through JMX, 'stop' the consumer's connections? For example,
> through the JConsole you can invoke the 'stop' operation on the consumer's
> connection.
>
> Joe
>
>
> Roger Hoover wrote:
> >
> > Stopping the consumers involves sending SIGTERM to them which could
> > kill them in the middle of processing a message.  Being able to
> > suspend delivery would allow us to make sure they were no longer
> > processing messages before we kill them.  Granted, we can get around
> > this problem by retrofitting the code to handle SIGTERM appropriately
> > but this would have been the easier approach.
> >
> > However, there may be other use cases for a "suspend delivery" feature.
> >
> > On 11/1/07, James Strachan <ja...@gmail.com> wrote:
> >> On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
> >> > While rolling out new consumer code, we'd like to suspend the broker
> >> > so that messages can be enqueued but not delivered.  Once we've pushed
> >> > the new code out and restarted the consumers, we want to resume
> >> > message delivery.
> >> >
> >> > Is this possible with ActiveMQ?
> >> >
> >> > Any advice/info is appreciated.  Thanks,
> >>
> >> Why not just stop the consumers, redeploy the code and restart them?
> >>
> >> --
> >> James
> >> -------
> >> http://macstrac.blogspot.com/
> >>
> >> Open Source SOA
> >> http://open.iona.com
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Is-it-possible-to-suspend-and-resume-message-delivery-for-broker--tf4733097s2354.html#a13539134
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Is it possible to suspend and resume message delivery for broker?

Posted by Diego Botticelli <di...@gmail.com>.
Maybe you could, through JMX, 'stop' the consumer's connections? For example,
through the JConsole you can invoke the 'stop' operation on the consumer's
connection. 

Joe
 

Roger Hoover wrote:
> 
> Stopping the consumers involves sending SIGTERM to them which could
> kill them in the middle of processing a message.  Being able to
> suspend delivery would allow us to make sure they were no longer
> processing messages before we kill them.  Granted, we can get around
> this problem by retrofitting the code to handle SIGTERM appropriately
> but this would have been the easier approach.
> 
> However, there may be other use cases for a "suspend delivery" feature.
> 
> On 11/1/07, James Strachan <ja...@gmail.com> wrote:
>> On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
>> > While rolling out new consumer code, we'd like to suspend the broker
>> > so that messages can be enqueued but not delivered.  Once we've pushed
>> > the new code out and restarted the consumers, we want to resume
>> > message delivery.
>> >
>> > Is this possible with ActiveMQ?
>> >
>> > Any advice/info is appreciated.  Thanks,
>>
>> Why not just stop the consumers, redeploy the code and restart them?
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source SOA
>> http://open.iona.com
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-it-possible-to-suspend-and-resume-message-delivery-for-broker--tf4733097s2354.html#a13539134
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Is it possible to suspend and resume message delivery for broker?

Posted by James Strachan <ja...@gmail.com>.
On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
> Stopping the consumers involves sending SIGTERM to them which could
> kill them in the middle of processing a message.  Being able to
> suspend delivery would allow us to make sure they were no longer
> processing messages before we kill them.  Granted, we can get around
> this problem by retrofitting the code to handle SIGTERM appropriately
> but this would have been the easier approach.

You could stop the consumer via JMX. Reconnection only applies to a
JMS Connection; so you should be able to stop a consumer via JMX
without it auto-reconnecting.

Though maybe we should support some kinda mechanism to stop
dispatching - though due to prefetch buffers, you'd still have to wait
for all the buffers to be emptied.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Re: Is it possible to suspend and resume message delivery for broker?

Posted by Roger Hoover <ro...@gmail.com>.
Stopping the consumers involves sending SIGTERM to them which could
kill them in the middle of processing a message.  Being able to
suspend delivery would allow us to make sure they were no longer
processing messages before we kill them.  Granted, we can get around
this problem by retrofitting the code to handle SIGTERM appropriately
but this would have been the easier approach.

However, there may be other use cases for a "suspend delivery" feature.

On 11/1/07, James Strachan <ja...@gmail.com> wrote:
> On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
> > While rolling out new consumer code, we'd like to suspend the broker
> > so that messages can be enqueued but not delivered.  Once we've pushed
> > the new code out and restarted the consumers, we want to resume
> > message delivery.
> >
> > Is this possible with ActiveMQ?
> >
> > Any advice/info is appreciated.  Thanks,
>
> Why not just stop the consumers, redeploy the code and restart them?
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source SOA
> http://open.iona.com
>

Re: Is it possible to suspend and resume message delivery for broker?

Posted by James Strachan <ja...@gmail.com>.
On 01/11/2007, Roger Hoover <ro...@gmail.com> wrote:
> While rolling out new consumer code, we'd like to suspend the broker
> so that messages can be enqueued but not delivered.  Once we've pushed
> the new code out and restarted the consumers, we want to resume
> message delivery.
>
> Is this possible with ActiveMQ?
>
> Any advice/info is appreciated.  Thanks,

Why not just stop the consumers, redeploy the code and restart them?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Re: Is it possible to suspend and resume message delivery for broker?

Posted by Bruce Snyder <br...@gmail.com>.
On 11/1/07, Roger Hoover <ro...@gmail.com> wrote:
> While rolling out new consumer code, we'd like to suspend the broker
> so that messages can be enqueued but not delivered.  Once we've pushed
> the new code out and restarted the consumers, we want to resume
> message delivery.
>
> Is this possible with ActiveMQ?
>
> Any advice/info is appreciated.  Thanks,

Why not configure the consumers to use the failover transport
(http://activemq.apache.org/failover-transport-reference.html) so that
they'll reconnect automatically? Even if a given consumer only
connects to a single broker, this is a good idea. And using the
initialReconnectDelay option will give the broker(s) time to restart
allowing the consumers to survive a broker going offline temporarily.

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

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/