This is an automated email from the ASF dual-hosted git repository. astitcher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit 3191f95d88b3dbf78ac46474b4ce89d7627fce32 Author: Andrew Stitcher <astitc...@apache.org> AuthorDate: Wed May 22 18:02:36 2024 -0400 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. --- python/proton/_handlers.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/proton/_handlers.py b/python/proton/_handlers.py index 79a6f3df5..e2d194db2 100644 --- a/python/proton/_handlers.py +++ b/python/proton/_handlers.py @@ -115,6 +115,7 @@ class OutgoingMessageHandler(Handler): self.on_rejected(event) elif dlv.remote_state == Delivery.RELEASED or dlv.remote_state == Delivery.MODIFIED: self.on_released(event) + self.on_delivery_updated(event) if dlv.settled: self.on_settled(event) if self.auto_settle: @@ -163,6 +164,18 @@ class OutgoingMessageHandler(Handler): if self.delegate is not None: _dispatch(self.delegate, 'on_released', event) + def on_delivery_updated(self, event: DeliveryEvent): + """ + Called when the remote peer updates the status of a delivery. Note that + this will be called even if the more specific disposition update events + are also called. + + :param event: The underlying event object. Use this to obtain further + information on the event. + """ + if self.delegate is not None: + _dispatch(self.delegate, 'on_delivery_updated', event) + def on_settled(self, event: DeliveryEvent): """ Called when the remote peer has settled the outgoing @@ -917,6 +930,17 @@ class MessagingHandler(Handler, Acking): """ pass + def on_delivery_updated(self, event: DeliveryEvent) -> None: + """ + Called when the remote peer updates the status of a delivery. Note that + this will be called even if the more specific disposition update events + are also called. + + :param event: The underlying event object. Use this to obtain further + information on the event. + """ + pass + def on_settled(self, event: DeliveryEvent) -> None: """ Called when the remote peer has settled the outgoing --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org