如何使用 Qpid Proton 显式确认或取消确认消息 Python

How to explicitly acknowledge or deacknowledge messages with Qpid Proton Python

我有一个 Qpid Proton Python MessageHandler 接收一些触发某些处理的消息。如果处理失败,如何拒绝消息?至于I can tell from the API documentation,默认是auto_accept=True。但是,将其更改为 False 似乎并不能避免确认消息,因为后续接收者没有赶上失败的消息。

如果您禁用自动接受,则明确接受或拒绝消息是您的责任。如果您两者都不做,消息就会陷入困境。

这是一个执行显式确认的应用程序代码示例:

def on_message(self, event):
    try:
        process_message(event.message)
        event.delivery.update(ACCEPTED)
    except:
        event.delivery.update(REJECTED)