How to explicitly acknowledge or deacknowledge messages with Qpid Proton Python

704 views Asked by At

I have a Qpid Proton Python MessageHandler receiving some messages which trigger some processing. 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. However, changing this to False doesn't seem to avoid acknowledging messages as a subsequent receiver doesn't catch up with the failing message.

1

There are 1 answers

2
Justin Ross On BEST ANSWER

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)