You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Marko Asplund <ma...@gmail.com> on 2016/10/21 13:36:48 UTC

Artemis automatic client reconnection?

Hi,

How do I get an Artemis client session to automatically reconnect after a
transient network disconnect or a server restart?

Messages are consumed using the Artemis Core API message handler, so
consumer processes are long-running and only create an Artemis client
session at startup.
Currently, the consumer doesn't seem to receive new messages after the
server is restarted. Client connections are initiated
using ActiveMQClient.createServerLocatorWithoutHA() (one server instance
only).

I'm using Artemis v1.4.0.

Marko

Re: Artemis automatic client reconnection?

Posted by Justin Bertram <jb...@apache.com>.
I believe you should just need to specify a non-zero value for reconnectAttempts, e.g.:

  ActiveMQClient.createServerLocator("tcp://myhost:61616?reconnectAttempts=10");

Or you can invoke setReconnectAttempts() on the ServerLocator object before you use it.

There's a couple of other parameters you can configure to control reconnection (e.g. retryInterval, retryIntervalMultiplier).

You can also check out the "reattach-node" example shipped with Artemis to see a working example.


Justin

----- Original Message -----
From: "Marko Asplund" <ma...@gmail.com>
To: "users" <us...@activemq.apache.org>
Sent: Friday, October 21, 2016 8:36:48 AM
Subject: Artemis automatic client reconnection?

Hi,

How do I get an Artemis client session to automatically reconnect after a
transient network disconnect or a server restart?

Messages are consumed using the Artemis Core API message handler, so
consumer processes are long-running and only create an Artemis client
session at startup.
Currently, the consumer doesn't seem to receive new messages after the
server is restarted. Client connections are initiated
using ActiveMQClient.createServerLocatorWithoutHA() (one server instance
only).

I'm using Artemis v1.4.0.

Marko