[
https://issues.apache.org/jira/browse/PROTON-1592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16202068#comment-16202068
]
Alan Conway commented on PROTON-1592:
-------------------------------------
It was the change below. We need to document the intended behavior properly, we
have not gotten as far as transactions in the API discussions.
I'm going to resolve this issue and open another for the API/documentation
discussion if needed.
fb439633ea999ecd2f0967bc94c03c276a2820c4
Author: Gordon Sim <[email protected]>
AuthorDate: Fri Aug 4 18:10:45 2017 +0100
Commit: Gordon Sim <[email protected]>
CommitDate: Fri Aug 4 18:10:45 2017 +0100
Parent: ca88f341 NO-JIRA: Change travis to compile with both gcc and clang
Merged: 0.17.0
Containing: TODO/cpp-uncounted TODO/sasl-realm go1 master ruby-deprecate
ruby-engine (4 more)
Follows: 0.17.0 (231)
Precedes: pre-abort (66)
PROTON-1530: delegate unhandled events
1 file changed, 5 insertions(+)
proton-c/bindings/python/proton/reactor.py | 5 +++++
modified proton-c/bindings/python/proton/reactor.py
@@ -864,6 +864,11 @@ class Container(Reactor):
if hasattr(event.delivery, "transaction"):
event.transaction = event.delivery.transaction
event.delivery.transaction.handle_outcome(event)
+
+ def on_unhandled(self, method, event):
+ if handler:
+ event.dispatch(handler)
+
context._txn_ctrl = self.create_sender(context, None,
name='txn-ctrl', handler=InternalTransactionHandler())
context._txn_ctrl.target.type = Terminus.COORDINATOR
context._txn_ctrl.target.capabilities.put_object(symbol(u'amqp:local-transactions'))
{noformat}
> [proton-python] accessing properties of event.receiver in on_link_opened
> throws exception
> -----------------------------------------------------------------------------------------
>
> Key: PROTON-1592
> URL: https://issues.apache.org/jira/browse/PROTON-1592
> Project: Qpid Proton
> Issue Type: Bug
> Components: python-binding
> Reporter: Jiri Daněk
> Assignee: Alan Conway
> Labels: regression
> Fix For: proton-c-0.18.0
>
>
> Apply the following patch to the {{tx-recv.py}} example
> {code}
> diff --git a/examples/python/tx_recv.py b/examples/python/tx_recv.py
> index 4baddcf5..54f3b489 100755
> --- a/examples/python/tx_recv.py
> +++ b/examples/python/tx_recv.py
> @@ -40,6 +40,9 @@ class TxRecv(MessagingHandler, TransactionHandler):
> self.container.declare_transaction(self.conn, handler=self)
> self.transaction = None
>
> + def on_link_opened(self, event):
> + event.receiver.drain_mode = True
> +
> def on_message(self, event):
> print(event.message.body)
> self.transaction.accept(event.delivery)
> {code}
> Now run first {{tx_send.py}}, then this {{tx_recv.py}}. The second command
> throws exception
> {noformat}
> $ LD_LIBRARY_PATH=`pwd`/lib64 PYTHONPATH=`pwd`/lib64/proton/bindings/python
> python ../examples/python/tx_recv.py
> Traceback (most recent call last):
> File "../examples/python/tx_recv.py", line 79, in <module>
> Container(TxRecv(opts.address, opts.messages, opts.batch_size)).run()
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
> line 148, in run
> while self.process(): pass
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
> line 174, in process
> self._check_errors()
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
> line 170, in _check_errors
> _compat.raise_(exc, value, tb)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 4068, in dispatch
> ev.dispatch(self.handler)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 3977, in dispatch
> result = dispatch(handler, type.method, self)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 3857, in dispatch
> return handler.on_unhandled(method, *args)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
> line 876, in on_unhandled
> event.dispatch(handler)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 3980, in dispatch
> self.dispatch(h, type)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 3977, in dispatch
> result = dispatch(handler, type.method, self)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 3855, in dispatch
> return m(*args)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/handlers.py",
> line 298, in on_link_remote_open
> self.on_link_opened(event)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/handlers.py",
> line 313, in on_link_opened
> dispatch(self.delegate, 'on_link_opened', event)
> File
> "/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
> line 3855, in dispatch
> return m(*args)
> File "../examples/python/tx_recv.py", line 44, in on_link_opened
> event.receiver.drain_mode = True
> AttributeError: 'NoneType' object has no attribute 'drain_mode'
> {noformat}
> To see this is a regression, repeat now with python-qpid-proton 0.17.0 from
> Pypi. With this previous release, there is success.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]