On 12/15/2010 08:01 AM, gcutuli wrote:
can someone help me in understanding the usage of the class
"FailoverUpdates" provided by Qpid Messaging API ?

AMQP 0-10 defines a 'failover' exchange type. A client can bind a queue to that exchange and subscribe to it in order to maintain a current list of possible brokers to connect to should they need to failover.

The FailoverUpdates class is a simple utility designed to utilise that mechanism. You pass it a connection on construction, and it will subscribe to updates from the failover exchange and when receiving those will update the connection urls on the given connection. This will continue while the FailoverUpdate instance exists.

It is primarily of relevance when using the 'reconnect' option.

E.g.

  Connection connection(myurl);
  connection.open();
  connection.setOption("reconnect", true);
  FailoverUpdates updates(connection);
  //use connection normally...

or if you need more control of the lifetime:

  Connection connection(myurl);
  connection.open();
  connection.setOption("reconnect", true);
  std::auto_ptr<FailoverUpdates> updates(new
          FailoverUpdates(connection));
  //use connection normally...

Hope this helps.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to