txamqp-user team mailing list archive
-
txamqp-user team
-
Mailing list archive
-
Message #00064
Re: Opening and closing clients from a long running twisted
Hi (again),
On Sat, Aug 28, 2010 at 6:16 AM, Dave Peticolas <dave@xxxxxxxxxx> wrote:
>
> You want to call txclient.transport.loseConnection().
>
after closing client connection to the amqp broker I noticed a lot
of warnings into rabbitmq logs, since the connection is closed
without closing channels. (rabbit raises an exception).
Thinking about it, the right way to disconnect is to close the amqp channel,
but looking into the txamqp sources seems that ther's no method to close
a channel "correctly".
The patch is very trivial and "works for me":
--- txamqp.orig/src/txamqp/protocol.py 2010-08-05 13:18:05.000000000 +0200
+++ txamqp/src/txamqp/protocol.py 2010-08-30 10:32:22.000000000 +0200
@@ -32,9 +32,11 @@
self.closed = False
self.reason = None
+ @defer.inlineCallbacks
def close(self, reason):
if self.closed:
return
+ yield self.channel_close()
self.closed = True
self.reason = reason
self.incoming.close()
The patch is also in my branch:
lp:~mbrancaleoni/txamqp/immediate-with-transactions
Doing in that way there's no need to close the tcp connection, since is done by
server after calling the amqp method channel.channel_close.
Hope that's correct.
thanks and best regards,
mat
Follow ups
References