You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jlindwall <jl...@yahoo.com> on 2015/07/01 03:01:29 UTC

Client reaction to server failure

We are planning a cluster using master/slave pairs.  The clients will use the
discovery protocol.

What happens when the server that a client is connected to goes down?  In
the simple case, my understanding is that the activemq client library will
automatically reconnect to another server in the cluster.

More interesting, is what happens when a request is interrupted mid-flight? 
Say the client is calling publish when the server goes down. Does the client
reconnect to another node and re-issue the publish invocation? Is there any
possibility of the messages getting duplicated (some delivered in the
initial connection to server A and then again in the new connection to
server B)?

Same question for a subscriber that is interrupted... When it automatically
reconnects could it receive a duplicate message?

Any other issues to be aware if when a reconnect happens, on the client app
side?  Thanks!




--
View this message in context: http://activemq.2283324.n4.nabble.com/Client-reaction-to-server-failure-tp4698426.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Client reaction to server failure

Posted by artnaseef <ar...@artnaseef.com>.
That's right, there will always be a chance of duplicate messages - hence the
JMSRedelivered flag in the JMS specification itself.

Specifically responding to the use-case in question, the failover transport
re-attempts message sends if they have not completed successfully on a prior
attempt.  If the broker already received the message, yes it will get
duplicated.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Client-reaction-to-server-failure-tp4698426p4698967.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Client reaction to server failure

Posted by jlindwall <jl...@yahoo.com>.
Thanks for the response. We can live with "at least once" semantics, so we'll
go that route.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Client-reaction-to-server-failure-tp4698426p4699364.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Client reaction to server failure

Posted by Tim Bain <tb...@alumni.duke.edu>.
I believe there is no way to guarantee once-and-only-once delivery in the
face of failures; there will always be race conditions that allow the two
sides of the interaction to believe different things about whether the
transaction succeeded or failed, and you have to choose whether you'd
rather have at-least-once delivery or at-most-once delivery.  Pick your
poison, and design your system to be tolerant of whichever one you pick.

On Wed, Jul 1, 2015 at 1:00 PM, jlindwall <jl...@yahoo.com> wrote:

> I should add that our messages are sent as persistent messages.
>
> It has been my belief that this means the messages are saved to persistent
> storage before the publish() call is acknowledged; therefore if the master
> broker goes down at that instant, the slave will awaken and pick up
> delivering that message to all consumers.
>
> Reading this blog entry by Christian Posta makes me question my belief
> though:
>
>
> http://blog.christianposta.com/guaranteed-messaging-for-topics-the-jms-spec-and-activemq/
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Client-reaction-to-server-failure-tp4698426p4698447.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Client reaction to server failure

Posted by jlindwall <jl...@yahoo.com>.
I should add that our messages are sent as persistent messages.

It has been my belief that this means the messages are saved to persistent
storage before the publish() call is acknowledged; therefore if the master
broker goes down at that instant, the slave will awaken and pick up
delivering that message to all consumers.

Reading this blog entry by Christian Posta makes me question my belief
though:

http://blog.christianposta.com/guaranteed-messaging-for-topics-the-jms-spec-and-activemq/




--
View this message in context: http://activemq.2283324.n4.nabble.com/Client-reaction-to-server-failure-tp4698426p4698447.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.