2.14. Cluster Failover

The messaging broker can be run in clustering mode, which provides high reliability through replicating state between brokers in the cluster. If one broker in a cluster fails, clients can choose another broker in the cluster and continue their work. Each broker in the cluster also advertises the addresses of all known brokers [11] . A client can use this information to dynamically keep the list of reconnection urls up to date.

In C++, the FailoverUpdates class provides this functionality:

Example 2.19. Tracking cluster membership

In C++:

	#include <qpid/messaging/FailoverUpdates.h>
	Connection connection("localhost:5672");
	connection.setOption("reconnect", true);
	try {
	std::auto_ptr<FailoverUpdates> updates(new FailoverUpdates(connection));

In python:

	import qpid.messaging.util
	connection = Connection("localhost:5672")
	connection.reconnect = True

In .NET C#:

	  using Org.Apache.Qpid.Messaging;
	  connection = new Connection("localhost:5672");
	  connection.SetOption("reconnect", true);
	  try {
	  FailoverUpdates failover = new FailoverUpdates(connection);


[11] This is done via the amq.failover exchange in AMQP 0-10