Red Hat DocumentationFuse ESBToggle FramesPrintFeedback

Failover Protocol

Overview

The failover protocol is primarily used by clients to facilitate recovery from network failures. When a recoverable network error occurs the protocol catches the error and automatically attempts to reestablish the JMS connection to an alternate broker endpoint without the need to recreate all of the JMS objects associated with the JMS connection. The failover URI is composed of one or more URIs that represent different broker transport connectors. By default, the protocol randomly chooses a URI from the list and attempts to establish a network connection to it. If it does not succeed, or if it subsequently fails, a new network connection is established to one of the other URIs in the list.

Brokers in a network of brokers can be configured to dynamically update their clients' failover lists. The brokers inform their clients about the other brokers in the network so that in the event of a failure the clients know how to connect to a running broker. The brokers update their clients as new brokers join and leave the network.

For more information about configuring a client to use the failover protocol see Failover Protocol in Broker Client Connectivity Guide.

Using failover in the broker

Brokers should never use the failover protocol when configuring its transport connectors. The failover protocol does not support listening for incoming connections.

In general, brokers should not use the failover protocol when configuring its network connectors. The failover protocol's reconnect logic cannot recreate the network bridge between two brokers. It interferes with the network connectors reconnect logic which is required to rebuild dropped network bridges.

The one case where you want to use the failover protocol in a network connector is when you are attempting to create a network of brokers that includes a master/slave cluster. See Fault Tolerant Broker Network for more information.

Configuring the broker to participate in dynamic failover

Configuring a broker to participate in dynamic failover requires two things:

  • The broker must be configured to participate in a network of brokers that can be available for failovers.

    See Broker Networks for information about setting up a network of brokers.

  • The broker's transport connector must set the failover properties needed to update its consumers.

Table 1 shows the broker properties that configure a failover cluster. These properties are exposed as attributes on the transportConnector element.

Table 1. Transport Connector Failover Properties

PropertyDefaultDescription
updateClusterClients falseSpecifies if the broker passes information to connected clients about changes in the topology of the broker cluster.
updateClusterClientsOnRemovefalseSpecifies if clients are updated when a broker is removed from the cluster.
rebalanceClusterClients falseSpecifies if connected clients are asked to rebalance across the cluster whenever a new broker joins.
updateClusterFilter Specifies a comma-separated list of regular expression filters, which match against broker names to select the brokers that belong to the failover cluster.
updateURIsURL  Specifies a URL, or path to a local file, locating a text file that contains a comma-separated list of URIs to use for reconnect in the case of failure.

Note

The update and rebalance features should only be enabled, only if the clients that connect to the broker cluster use Fuse Message Broker 5.4.0 or later. These features are incompatible with clients older than version 5.4.0.

Example

Example 1 shows the configuration for a broker that participates in dynamic failover.

Example 1. Broker for Dynamic Failover

<beans ... >
  <broker>
    ...
    <networkConnectors>
1      <networkConnector uri="multicast://default" />
    </networkConnectors>
    ...
    <transportConnectors>
      <transportConnector name="openwire"
          uri="tcp://0.0.0.0:61616"
2         discoveryUri="multicast://default"
3         updateClusterClients="true"
4         updateClusterFilter="*A*,*B*" />  
    </transportConnectors>
    ...
  </broker>
</beans>

The configuration in Example 1 does the following:

1

Creates a network connector that connects to any discoverable broker that uses the multicast transport.

2

Makes the broker discoverable by other brokers over the multicast protocol.

3

Makes the broker update the list of available brokers for clients that connect using the failover protocol.

Note

Clients will only be updated when new brokers join the cluster, not when a broker leaves the cluster.

4

Creates a filter so that only those brokers whose names start with the letter A or the letter B are considered to belong to the failover cluster.

Example 2 shows the URI for a client that uses the failover protocol to connect to the broker and its cluster.

Example 2. Failover URI for Connecting to a Failover Cluster

failover://(tcp://0.0.0.0:61616)?initialReconnectDelay=100

Comments powered by Disqus