Client failover
You can configure a client to fail over to another Diffusion™ server after it loses connection to the Diffusion server it was previously connected to.
Client failover is when a client loses its connection to a server and attempts to connect to a different one. The client is provided with a list of servers. If a client loses its connection to a server it can automatically attempt to connect to the next server in the list. If it fails to connect or loses its connection to that server, it tries the next server on the list. This is referred to as autofailover. Generally the list of servers to connect to must be provided before attempting to make the connection. How the list of servers is provided differs between client APIs and the JavaScript® client does not support autofailover but it can be implemented using the callback methods.
Using automatic failover
If a client has an established connection that it loses, autofailover attempts to open a new connection in the next connection in the list. This is not compatible with reconnection because reconnection attempts to preserve the state of the client (the client ID and the subscribed topics). As the new server has no knowledge of the client it is unable to preserve this state. Autofailover must be enabled and a list of servers to connect to provided.
Using load balancing with autofailover
You can enable load balancing in conjunction with autofailover. When load balancing is enabled and a client loses connection, the list of servers is shuffled before the client selects the next server to attempt to connect to.
In Java™ , for example, you can enable load balancing by using the setLoadBalancing method on the ConnectionDetails object.
Using server cascading
When a client attempts to place a connection, if the attempt fails, the next server in the list is chosen. Server cascading is similar to autofailover except this logic is applied prior to a connection, whereas autofailover applies once a connection is in place.
In Java , for example, you can enable server cascading by using the setCascading method on the ConnectionDetails object.