Repository: qpid-proton Updated Branches: refs/heads/master 6043a927c -> 8d22ffbbe
PROTON-1617 - python: expose delivery aborted feature. This closes #123 Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/8d22ffbb Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/8d22ffbb Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/8d22ffbb Branch: refs/heads/master Commit: 8d22ffbbe03e18d3e0994a03285efb0347ff8f40 Parents: 6043a92 Author: Ted Ross <tr...@redhat.com> Authored: Mon Oct 9 16:42:08 2017 -0400 Committer: Alan Conway <acon...@redhat.com> Committed: Tue Oct 10 17:59:38 2017 -0400 ---------------------------------------------------------------------- proton-c/bindings/python/proton/__init__.py | 13 +++++++++++++ proton-c/bindings/python/proton/handlers.py | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8d22ffbb/proton-c/bindings/python/proton/__init__.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index f73e99d..ddc7d3e 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -3275,6 +3275,19 @@ class Delivery(Wrapper): pn_delivery_settle(self._impl) @property + def aborted(self): + """Returns true if the delivery has been aborted.""" + return pn_delivery_aborted(self._impl) + + def abort(self): + """ + Aborts the delivery. This indicates the application wishes to + invalidate any data that may have already been sent on this delivery. + The delivery cannot be aborted after it has been completely delivered. + """ + pn_delivery_abort(self._impl) + + @property def work_next(self): return Delivery.wrap(pn_work_next(self._impl)) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/8d22ffbb/proton-c/bindings/python/proton/handlers.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/handlers.py b/proton-c/bindings/python/proton/handlers.py index cd646aa..55e02b1 100644 --- a/proton-c/bindings/python/proton/handlers.py +++ b/proton-c/bindings/python/proton/handlers.py @@ -156,7 +156,10 @@ class IncomingMessageHandler(Handler, Acking): def on_delivery(self, event): dlv = event.delivery if not dlv.link.is_receiver: return - if dlv.readable and not dlv.partial: + if dlv.aborted: + self.on_aborted(event) + dlv.settle() + elif dlv.readable and not dlv.partial: event.message = recv_msg(dlv) if event.link.state & Endpoint.LOCAL_CLOSED: if self.auto_accept: @@ -192,6 +195,10 @@ class IncomingMessageHandler(Handler, Acking): if self.delegate != None: dispatch(self.delegate, 'on_settled', event) + def on_aborted(self, event): + if self.delegate != None: + dispatch(self.delegate, 'on_aborted', event) + class EndpointStateHandler(Handler): """ A utility that exposes 'endpoint' events i.e. the open/close for --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org