简体   繁体   English

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

[英]How to explicitly acknowledge or deacknowledge messages with Qpid Proton Python

I have a Qpid Proton Python MessageHandler receiving some messages which trigger some processing.我有一个 Qpid Proton Python MessageHandler接收一些触发一些处理的消息。 How can I reject a message in case the processing fails?如果处理失败,我如何拒绝消息? As far as I can tell from the API documentation , the default is auto_accept=True .我从 API 文档中得知,默认值为auto_accept=True However, changing this to False doesn't seem to avoid acknowledging messages as a subsequent receiver doesn't catch up with the failing message.但是,将其更改为False似乎并不能避免确认消息,因为后续接收者没有赶上失败的消息。

If you disable auto accept, explicitly accepting or rejecting a message is your responsibility.如果您禁用自动接受,明确接受或拒绝消息是您的责任。 If you do neither, the message is stuck in limbo.如果您两者都不做,则消息将陷入困境。

Here's an example of application code that does explicit acks:这是执行显式确认的应用程序代码示例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM