Search

5.2.3. Message Rejection

download PDF
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.
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.