You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by siddutta <si...@live.com> on 2016/05/13 07:44:14 UTC

Simulating loss of broker publisher connectivity

I wish to run an experiment in which the publisher loses connection with the
broker and then enqueues them in its own queue and then when it regains
connectivity it send s all its queued messages to the broker. How can I I do
this since if I call close connection, I can no longer send(raises an
exception). A trick that I can think of is to use a network of two brokers
and simulate the above by breaking the connection between the two brokers.
Is there an API call that I can use to do the above?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Simulating-loss-of-broker-publisher-connectivity-tp4711888.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Simulating loss of broker publisher connectivity

Posted by Tim Bain <tb...@alumni.duke.edu>.
Publishers can't enqueue messages locally without a broker.  No broker, no
work done.

However, it's possible to embed a broker within the producer process, which
would then connect to the external broker when available and buffer
messages when the connection is broken.  But this adds complexity to your
configuration and you need to think about what you want to happen when the
producer process (and its embedded broker) are stopped.  Only go down this
path if you need the ability to continue producing messages when a
connection to the broker is unavailable; if you don't truly need that, it's
not worth the effort you'll put into it.

Tim
On May 13, 2016 12:30 PM, "Jiri Danek" <jd...@redhat.com> wrote:

On Fri, May 13, 2016 at 9:44 AM, siddutta <si...@live.com> wrote:

> I wish to run an experiment in which the publisher loses connection with
> the
> broker and then enqueues them in its own queue and then when it regains
> connectivity it send s all its queued messages to the broker. How can I I
> do
> this since if I call close connection, I can no longer send(raises an
> exception). A trick that I can think of is to use a network of two brokers
> and simulate the above by breaking the connection between the two brokers.
> Is there an API call that I can use to do the above?
>

You could try sending a SIGSTOP signal to the broker process, wait for a
while, and then send it a SIGCONT. If the broker is running in a terminal,
you can do Ctrl+z to pause it and then fg to resume it. If you do this,
connection stays open, but broker stops responding. I believe that from the
point of view of the publisher, this is indistinguishable from a network
failure between the publisher and the router.
 --
Jiří Daněk

Re: Simulating loss of broker publisher connectivity

Posted by Jiri Danek <jd...@redhat.com>.
On Fri, May 13, 2016 at 9:44 AM, siddutta <si...@live.com> wrote:

> I wish to run an experiment in which the publisher loses connection with
> the
> broker and then enqueues them in its own queue and then when it regains
> connectivity it send s all its queued messages to the broker. How can I I
> do
> this since if I call close connection, I can no longer send(raises an
> exception). A trick that I can think of is to use a network of two brokers
> and simulate the above by breaking the connection between the two brokers.
> Is there an API call that I can use to do the above?
>

You could try sending a SIGSTOP signal to the broker process, wait for a
while, and then send it a SIGCONT. If the broker is running in a terminal,
you can do Ctrl+z to pause it and then fg to resume it. If you do this,
connection stays open, but broker stops responding. I believe that from the
point of view of the publisher, this is indistinguishable from a network
failure between the publisher and the router.
 --
Jiří Daněk