Show Table of Contents
7.2.6. Asynchronous Message Sending Example
The following code demonstrates using the properties of a sender to manage asynchronous send operations, with the option to avoid synchronous blocking when the sender is at capacity:
- C++
sender.setCapacity(MY_CAPACITY); // Later bool resend = true; while (resend) { if (sender.getAvailable()>0) { sender.send(message,false); resend = false; } else { // May wish to do nothing here // or send to log file std::cout << "Warning: Capacity \ full. Retry" << std::endl; } } // Later if (sender.getUnsettled()) { session.sync(); }- Python
snd.capacity = MY_CAPACITY # Later resend = True while (resend): if (snd.available()>0): snd.send(msg, sync = False) resend = False else: print "Warning: Capacity full" # Later if (snd.unsettled()): ssn.sync()

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.