5.2.3. Message Rejection
After acquiring a message on a reliable link your application can reject it. When a message is rejected the broker will delete it from the queue. If the queue is configured with an
alternate exchange
, then the rejected message is routed there; otherwise it is discarded.
To reject a message using the Python API, call the
acknowledge()
method of the session, passing in the message that you wish to reject, and specify REJECTED
as the Disposition
parameter:
- Python
msg = rx.fetch(timeout = 1) if msg.content == "something we don't like": ssn.acknowledge(msg, Disposition(REJECTED)) else: ssn.acknowledge(msg)
Note that this is only possible when using a reliable link. When using an
unreliable
link, mesages are implicitly acknowledged when they are fetched.