You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/10/19 12:39:51 UTC

[05/50] qpid-proton git commit: PROTON-1617 - python: expose delivery aborted feature.

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/go1
Commit: 8d22ffbbe03e18d3e0994a03285efb0347ff8f40
Parents: 6043a92
Author: Ted Ross <tr...@redhat.com>
Authored: Mon Oct 9 16:42:08 2017 -0400
Committer: Alan Conway <ac...@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-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org