Search

7.3.3. Asynchronously Acknowledging Received Messages

download PDF
A reliable link (technically called a link with at-least-once reliablity) is the default link used when a receiver is created without specifying a link reliability. For message acknowledgement on unreliable links refer to Acknowledging Messages Received Over an Unreliable Link. Messages received over a reliable link are set to acquired on the broker until they are acknowledged by the consumer. When a message is in acquired mode it is not visible in the queue. If the consumer disconnects without acknowledging receipt, the message will be moved out of acquired and again become available to consumers, with the header redelivered=true.
To remove the message from the queue, a consumer needs to acknowledge receipt of the message.
In Python, this is done by calling the acknowledge() method of the session object:
Python
session.acknowledge()
Calling the acknowledge() method with no arguments acknowledges receipt of all as-yet-unacknowledged messages fetched using that session. To acknowledge a specific message, pass the message as an argument. For example:
Python
msg = rx.fetch(timeout = 1)
session.acknowledge(msg)
This method executes synchronously by default, and will wait for the broker to respond before returning. It can also be invoked asynchronously, by supplying the sync = False parameter:
Python
session.acknowledge(msg, sync = False)
Acknowledging Messages Received Over an Unreliable Link

When an unreliable link is requested for a receiver, acknowledgement is implicit when a message is fetched. This means that the broker marks the message as acquired as soon as the receiver fetches it. No acknowledgement is necessary, and no release or rejection of messages is possible.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.