Search

7.2. Asynchronous Sending

download PDF

7.2.1. Synchronous and Asynchronous Send

When a sender sends synchronously over a reliable link, execution in the sender's thread is blocked until the sender receives an acknowledgement from the broker. This is useful for testing and troubleshooting, but by introducing a round-trip for every message, this reduces the potential throughput of the system.
When using the C++ API, all calls are asynchronous by default. When using the Python API, however, the opposite is true - by default, a sender sends a message synchronously.
You can send messages asynchronously, which allows you to maximise your network bandwidth usage and throughput. When invoked asynchronously, a send call will return immediately, without waiting for a receipt from the broker.
For example, the following call to the send() method of a send object is asynchronous - it returns immediately, without waiting for a receipt from the broker:
Python
sender.send(message, sync = False)
C++
sender.send(message, false)
Note that this is the default behavior for the C++ API.
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.