qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: About failoverUpdates
Date Wed, 15 Dec 2010 10:29:17 GMT
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.


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

or if you need more control of the lifetime:

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

Hope this helps.

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org

View raw message