On Thu, 2010-02-04 at 15:43 +0800, Sebastian Rodriguez wrote: > Hi Martin, > I'm not an expert of the Cpp client and I'm more familiar to the .NEt > client, but looking at the ActiveMQConnection.h, it seems the cpp client has > the same exceptions and listeners than the .NET counterpart: > > public: // TransportListener > > /** > * Adds a transport listener so that a client can be notified of > events in > * the underlying transport, client's are always notified after the > event has > * been processed by the Connection class. Client's should ensure > that the > * registered listener does not block or take a long amount of time > to execute > * in order to not degrade performance of this Connection. > * > * @param transportListener > * The TransportListener instance to add to this Connection's > set of listeners > * to notify of Transport events. > */ > void addTransportListener( transport::TransportListener* > transportListener ); > > /** > * Removes a registered TransportListener from the Connection's set > of Transport > * listeners, this listener will no longer receive any Transport > related events. The > * caller is responsible for freeing the listener in all cases. > * > * @param transportListener > * The pointer to the TransportListener to remove from the set > of listeners. > */ > void removeTransportListener( transport::TransportListener* > transportListener ); > > /** > * Event handler for the receipt of a non-response command from the > * transport. > * @param command the received command object. > */ > virtual void onCommand( const Pointer<commands::Command>& command ); > > /** > * Event handler for an exception from a command transport. > * @param ex The exception. > */ > virtual void onException( const decaf::lang::Exception& ex ); > > /** > * The transport has suffered an interruption from which it hopes to > recover > */ > virtual void transportInterrupted(); > > /** > * The transport has resumed after an interruption > */ > virtual void transportResumed(); > > But, the "problem" in your case is that, while using the failover transport, > these will not be triggered, as they are managed by the failover transport. > Maybe the behaivour in the CPP client is different and the transport > listener will actually report the events, I'll let the experts correct me in > this matter :) > > Regards, > Seb >
Actually the transportInterrupted and transportResumed methods would be invoked if the Failover transport is in use and the connection drops, the client just needs to register a class that implements the TransportListener interface and add it via addTransportListener. Regards Tim. > On 4 February 2010 15:01, Martin C. <mart...@gmx.at> wrote: > > > > > Hi, > > > > I am using the failover transport in ActiveMQ-CPP and I'd like to know if > > there is a similar way to monitor the state of the connection as in the > > Java > > implemention, where you can register a TransportListener to the connection, > > which in turn gets notified if the connection is currently interrupted or > > working. > > > > Thanks in advance for any help. > > > > Best regards, > > Martin > > -- > > View this message in context: > > http://old.nabble.com/ActiveMQ-CPP-Connection-monitoring-tp27448492p27448492.html > > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > > > > > > -- Tim Bish http://fusesource.com http://timbish.blogspot.com/