Red Hat DocumentationFuse Message BrokerToggle FramesPrintFeedback

Dynamic Failover

Overview

Dynamic failover combines the failover protocol and a network of brokers to allow a broker to supply its clients with a list of broker connections to which the clients can failover. Clients use a failover URI to connect to a broker and the broker dynamically updates the clients' list of available URIs. The broker updates its clients' failover lists with the URIs of the other brokers in its network of brokers that are currently running. As new brokers join, or exit, the cluster, the broker will adjust its clients' failover lists.

From a connectivity point of view, dynamic failover works the same as static failover. A client randomly chooses a URI from the list provided in its failover URI. Once that connection is established, the list of available brokers is updated. If the original connection fails, the client will randomly select a new URI from its dynamically generated list of brokers. If the new broker is configured for dynamic failover, the new broker will update the client's list.

Set-up

To use dynamic failover you must configure both the clients and brokers used by your application. The following must be configured:

  • The client's must be configured to use the failover protocol when connecting with its broker.

  • The brokers must be configured to form a network of brokers.

    See ????.

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

Client-side configuration

The client-side configuration for using dynamic failover is identical to the client-side configuration for using static failover. The client uses a failover URI to connect to a broker.

When using dynamic failover, the failover URI can include a single broker URI. As long as the broker is available when the client attempts to make its initial connection, the client's list of failover brokers will get populated.

It is also important that the updateURIsSupported option not be set to false. If it is, the client will not be able to receive updates about what brokers are available for failover.

See ???? and ???? for more information about using failover URIs.

Broker-side configuration

Important

Brokers should never use a failover uri to configure a transport connector. The failover protocol does not support listening for incoming messages.

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 ???? 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 2 describes the broker-side properties that can be used to configure a failover cluster. These properties are attributes on the broker's transportConnector element.

Table 2. Broker-side 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.

Example

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

Example 2. 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 2 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 3 shows the URI for a client that uses the failover protocol to connect to the broker and its cluster.

Example 3. Failover URI for Connecting to a Failover Cluster

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

Comments powered by Disqus