You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by gcutuli <gi...@numonyx.com> on 2010/12/15 09:01:39 UTC

About failoverUpdates

Dear all,
can someone help me in understanding the usage of the class
"FailoverUpdates" provided by Qpid Messaging API ?
Thanks in advance.
-- 
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/About-failoverUpdates-tp5837418p5837418.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

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


Re: About failoverUpdates

Posted by Gordon Sim <gs...@redhat.com>.
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:users-subscribe@qpid.apache.org