You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Alan Conway <ac...@redhat.com> on 2009/10/21 21:48:29 UTC

[c++] Removing getKnownBrokers from client::Connection

Currently there is functionality built-in to client::Connection to check if 
there's an amq.failover exchange, and if there is to subscribe for updates. This 
is exposed to the user as client::Connection::getKnownBrokers() which returns 
the updated set of brokers in the cluster.

I sorely regret building this in to client::Connection as has been nothing but 
trouble. Currently it's causing sporadic memory leaks. It also does extra work 
on _every_ Connection::open that is entirely useless if you're not talking to a 
qpid C++ clustered broker.

I'd like to take it out and provide the functionality as a separate class that 
users can employ if they actually want this functionality. Anyone know a reason 
why I shouldn't do this?

Cheers,
Alan.

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


Re: [c++] Removing getKnownBrokers from client::Connection

Posted by Alan Conway <ac...@redhat.com>.
On 10/22/2009 09:10 AM, Gordon Sim wrote:
> On 10/21/2009 08:48 PM, Alan Conway wrote:
>> Currently there is functionality built-in to client::Connection to check
>> if there's an amq.failover exchange, and if there is to subscribe for
>> updates. This is exposed to the user as
>> client::Connection::getKnownBrokers() which returns the updated set of
>> brokers in the cluster.
>>
>> I sorely regret building this in to client::Connection as has been
>> nothing but trouble. Currently it's causing sporadic memory leaks. It
>> also does extra work on _every_ Connection::open that is entirely
>> useless if you're not talking to a qpid C++ clustered broker.
>>
>> I'd like to take it out and provide the functionality as a separate
>> class that users can employ if they actually want this functionality.
>
> Could this alternative mechanism also be used to provide the same
> semantics for the existing Connection::getKnownBrokers() call?
>

Yes, I envision the following code change

// Old code
Connection c;
...
c.getKnownBrokers() // get latest list

// New code
Connection c;
FailoverListener fl(c);
...
fl.getKnownBrokers() // get latest list


However I see there is a bunch of automatic re-connection coe in 
ConnectionImpl.cpp. It looks like we automatically attempt to connect using 
getKnownBrokers if the plain URL doesn't work. I think this would also have to 
be moved to another class (FailoverManager?) to get the FailoverListener out of 
Connection. I'd like to go over this logic before I proceed, can you ping me 
when you have time?

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


Re: [c++] Removing getKnownBrokers from client::Connection

Posted by Gordon Sim <gs...@redhat.com>.
On 10/21/2009 08:48 PM, Alan Conway wrote:
> Currently there is functionality built-in to client::Connection to check
> if there's an amq.failover exchange, and if there is to subscribe for
> updates. This is exposed to the user as
> client::Connection::getKnownBrokers() which returns the updated set of
> brokers in the cluster.
>
> I sorely regret building this in to client::Connection as has been
> nothing but trouble. Currently it's causing sporadic memory leaks. It
> also does extra work on _every_ Connection::open that is entirely
> useless if you're not talking to a qpid C++ clustered broker.
>
> I'd like to take it out and provide the functionality as a separate
> class that users can employ if they actually want this functionality.

Could this alternative mechanism also be used to provide the same 
semantics for the existing Connection::getKnownBrokers() call?

> Anyone know a reason why I shouldn't do this?
>
> Cheers,
> Alan.


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


RE: [c++] Removing getKnownBrokers from client::Connection

Posted by Steve Huston <sh...@riverace.com>.
Hi Alan,

> Currently there is functionality built-in to 
> client::Connection to check if 
> there's an amq.failover exchange, and if there is to 
> subscribe for updates. This 
> is exposed to the user as 
> client::Connection::getKnownBrokers() which returns 
> the updated set of brokers in the cluster.
> 
> I sorely regret building this in to client::Connection as has 
> been nothing but 
> trouble. Currently it's causing sporadic memory leaks. It 
> also does extra work 
> on _every_ Connection::open that is entirely useless if 
> you're not talking to a 
> qpid C++ clustered broker.
> 
> I'd like to take it out and provide the functionality as a 
> separate class that 
> users can employ if they actually want this functionality. 
> Anyone know a reason 
> why I shouldn't do this?

No. Sounds reasonable to me.

-Steve


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