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" <marko.aspl...@gmail.com>
To: "users" <users@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

Reply via email to