qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [13/50] qpid-proton git commit: PROTON-1592: [python] tx_recv.py raises exception.
Date Thu, 19 Oct 2017 12:39:59 GMT
PROTON-1592: [python] tx_recv.py raises exception.

Fixed the example: starting a transactional internally opens a sending link for
transactional commands. The example was coded on the assumption that the only
link being opened was its own receiver link, which is incorrect.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/198664fc
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/198664fc
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/198664fc

Branch: refs/heads/go1
Commit: 198664fc8e0273d4eab9f6d6f73df20114080a8c
Parents: 1bb1897
Author: Alan Conway <aconway@redhat.com>
Authored: Tue Oct 10 13:07:20 2017 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Wed Oct 11 22:04:42 2017 -0400

----------------------------------------------------------------------
 examples/python/tx_recv.py | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/198664fc/examples/python/tx_recv.py
----------------------------------------------------------------------
diff --git a/examples/python/tx_recv.py b/examples/python/tx_recv.py
index 4baddcf..7c0b7cc 100755
--- a/examples/python/tx_recv.py
+++ b/examples/python/tx_recv.py
@@ -40,6 +40,12 @@ class TxRecv(MessagingHandler, TransactionHandler):
         self.container.declare_transaction(self.conn, handler=self)
         self.transaction = None
 
+    def on_link_opened(self, event):
+        # NOTE: a transactional client opens an internal sender link for transaction commands,
+        # which we want to ignore.
+        if event.receiver:
+            event.receiver.drain_mode = True
+
     def on_message(self, event):
         print(event.message.body)
         self.transaction.accept(event.delivery)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message