Show Table of Contents
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.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.