You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Neil Pritchard <Ne...@securetrading.com> on 2010/09/10 17:18:47 UTC

Checking state of connection to broker in pyactivemq

Hi All,

I'm using pyactivemq with ActiveMQ-CPP 3.2.2 as both producer and consumer of messages, which are being brokered by a (Java) ActiveMQ 5.3.2 exchange.
I have three boxes, each performing the same type of tasks. Each box may produce, and consume messages who's payload contain an event trigger that needs to be run 'off-line' so that the process does not block the main process that the box performs.

For redundancy, I intend to have the consumers failover to an exchange on one of the other two boxes should the local exchange die.  I'll also allow the consumers to listen to queues on all three boxes, for load balancing and redundancy.

If a consumer looses the pipe to the local exchange, I need it to raise an exception.  Is there any way that I can use code already written in pyactivemq to check the state of the connection to the queue on the exchange, so that I may check that state in a loop ?

Many thanks,

Neil Pritchard

Re: Checking state of connection to broker in pyactivemq

Posted by Timothy Bish <ta...@gmail.com>.
On Fri, 2010-09-10 at 16:18 +0100, Neil Pritchard wrote:
> Hi All,
> 
> I'm using pyactivemq with ActiveMQ-CPP 3.2.2 as both producer and consumer of messages, which are being brokered by a (Java) ActiveMQ 5.3.2 exchange.
> I have three boxes, each performing the same type of tasks. Each box may produce, and consume messages who's payload contain an event trigger that needs to be run 'off-line' so that the process does not block the main process that the box performs.
> 
> For redundancy, I intend to have the consumers failover to an exchange on one of the other two boxes should the local exchange die.  I'll also allow the consumers to listen to queues on all three boxes, for load balancing and redundancy.
> 
> If a consumer looses the pipe to the local exchange, I need it to raise an exception.  Is there any way that I can use code already written in pyactivemq to check the state of the connection to the queue on the exchange, so that I may check that state in a loop ?
> 
> Many thanks,
> 
> Neil Pritchard

Unfortunately pyActiveMQ doesn't currently export the a property from
the Connection object to set a Transport listener so you won't be able
to tell when the transport is interrupted and resumed when using the
Failover Transport.  When no using the Failover transport the Connection
would notify the client of the error through an ExceptionListener that
the client code had registered.

Regards

-- 
Tim Bish