Questo contenuto non è disponibile nella lingua selezionata.

7.3.3. Asynchronously Acknowledging Received Messages


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()
Copy to Clipboard Toggle word wrap
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)
Copy to Clipboard Toggle word wrap
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)
Copy to Clipboard Toggle word wrap
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.

Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat