On 29 Jan, 10:11 pm, [email protected] wrote:
Hi Folks:
I need to maintain a programme that uses txampq_helper library
ampqFactory. The current program does not close the connection to the
underlying rabbitmq (the code is a mess).
Can I simple call theampqFactory.protocol.transport.loseConnection()?
Does this factory keep a reference to a connected protocol as its
`protocol` attribute? Most factories keep a reference to their protocol
class there.
If it isn't keeping a reference to the instance then you won't be able
to disconnect it this way, you'll have to find a reference to it some
other way.
One easy way to do this is to wrap the factory with `WrappingFactory`
from `twisted.protocols.policies`. This factory keeps a `protocols`
dictionary on itself tracking all of the currently-connected protocols
it (and the wrapped factory) have been used to create.
Do I need to unregisterProducer() first (in ampqFactory, i see stuff
like resumeProducing() so I assume it is a producer)
You do need to unregister, yes. Alternatively, you can use
`abortConnection` as long as the transport you're using has implemented
that method (and as long as you don't care if some bytes in the send
buffer get dropped).
Jean-Paul
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python