Skip to content

Commit 3191f95

Browse files
committed
PROTON-2893: [Python] Add callback for all delivery updates
This is useful for responding to delivery updates besides the common AMQP updates. Specifically for better transaction support.
1 parent d8ff8f7 commit 3191f95

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

python/proton/_handlers.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def on_delivery(self, event: DeliveryEvent):
115115
self.on_rejected(event)
116116
elif dlv.remote_state == Delivery.RELEASED or dlv.remote_state == Delivery.MODIFIED:
117117
self.on_released(event)
118+
self.on_delivery_updated(event)
118119
if dlv.settled:
119120
self.on_settled(event)
120121
if self.auto_settle:
@@ -163,6 +164,18 @@ def on_released(self, event: DeliveryEvent):
163164
if self.delegate is not None:
164165
_dispatch(self.delegate, 'on_released', event)
165166

167+
def on_delivery_updated(self, event: DeliveryEvent):
168+
"""
169+
Called when the remote peer updates the status of a delivery. Note that
170+
this will be called even if the more specific disposition update events
171+
are also called.
172+
173+
:param event: The underlying event object. Use this to obtain further
174+
information on the event.
175+
"""
176+
if self.delegate is not None:
177+
_dispatch(self.delegate, 'on_delivery_updated', event)
178+
166179
def on_settled(self, event: DeliveryEvent):
167180
"""
168181
Called when the remote peer has settled the outgoing
@@ -917,6 +930,17 @@ def on_released(self, event: DeliveryEvent) -> None:
917930
"""
918931
pass
919932

933+
def on_delivery_updated(self, event: DeliveryEvent) -> None:
934+
"""
935+
Called when the remote peer updates the status of a delivery. Note that
936+
this will be called even if the more specific disposition update events
937+
are also called.
938+
939+
:param event: The underlying event object. Use this to obtain further
940+
information on the event.
941+
"""
942+
pass
943+
920944
def on_settled(self, event: DeliveryEvent) -> None:
921945
"""
922946
Called when the remote peer has settled the outgoing

0 commit comments

Comments
 (0)