not occur if the client fails to make an initial connection to the live server. If it does fail its initial attempt, a
client would simply retry connecting to the live server according to the reconnect-attempts property
and fail after the configured number of attempts.
/subsystem=messaging-activemq/server=default/connection-
factory=RemoteConnectionFactory:write-attribute(name=reconnect-attempts,value=<NEW_VALUE>)
An exception to this rule is the case where there is only one pair of live - backup servers, and no other
live server, and a remote MDB is connected to the live server when it is cleanly shut down. If the MDB has
configured @ActivationConfigProperty(propertyName = "rebalanceConnections", propertyValue =
"true"), it tries to rebalance its connection to another live server and will not failover to the backup.
Failing Over on the Initial Connection
Since the client does not learn about the full topology until after the first connection is made, there is a
window of time where it does not know about the backup. If a failure happens at this point the client can
only try reconnecting to the original live server. To configure how many attempts the client will make you
can set the property initialConnectAttempts on the ClientSessionFactoryImpl or
ActiveMQConnectionFactory.
Alternatively in the server configuration, you can set the initial-connect-attempts attribute of the
connection factory used by the client. The default for this is 0, that is, try only once. Once the number of
attempts has been made, an exception will be thrown.
/subsystem=messaging-activemq/server=default/connection-
factory=RemoteConnectionFactory:write-attribute(name=initial-connect-attempts,value=
<NEW_VALUE>)
About Server Replication
JBoss EAP messaging does not replicate full server state between live and backup servers. When the
new session is automatically recreated on the backup, it won’t have any knowledge of the messages
already sent or acknowledged during that session. Any in-flight sends or acknowledgements at the time
of failover may also be lost.
By replicating full server state, JBoss EAP messaging could theoretically provide a 100% transparent
seamless failover, avoiding any lost messages or acknowledgements. However, doing so comes at a
great cost: replicating the full server state, including the queues and session. This would require
replication of the entire server state machine. That is, every operation on the live server would have to
replicated on the replica servers in the exact same global order to ensure a consistent replica state. This
is extremely hard to do in a performant and scalable way, especially considering that multiple threads are
changing the live server state concurrently.
It is possible to provide full state machine replication using techniques such as virtual synchrony, but this
does not scale well and effectively serializes all operations to a single thread, dramatically reducing
concurrency. Other techniques for multi-threaded active replication exist such as replicating lock states
or replicating thread scheduling, but this is very hard to achieve at a Java level.
Consequently, it was not worth reducing performance and concurrency for the sake of 100% transparent
failover. Even without 100% transparent failover, it is simple to guarantee once and only once delivery,
even in the case of failure, by using a combination of duplicate detection and retrying of transactions.
However this is not 100% transparent to the client code.
30.7.1.1. Handling Blocking Calls During Failover
If the client code is in a blocking call to the server, i.e. it is waiting for a response to continue its