Search

18.4. Asynchronous Send Acknowledgments

download PDF
If you are using a non-transacted session but want a guarantee that every message sent to the server has reached it, then, as discussed in Section 18.2, “Guarantees of Non Transactional Message Sends”, you can configure HornetQ to block the call to send until the server has received the message, persisted it and sent back a response. This works well but has a severe performance penalty - each call to send needs to block for at least the time of a network round trip (RTT) - the performance of sending is thus limited by the latency of the network, not limited by the network bandwidth.
To remedy this, HornetQ provides a feature called asynchronous send acknowledgments. With this feature, HornetQ can be configured to send messages without blocking in one direction and asynchronously getting acknowledgment from the server that the messages were received in a separate stream. By decoupling the send from the acknowledgment of the send, the system is not limited by the network RTT, but is limited by the network bandwidth. Consequently better throughput can be achieved than is possible using a blocking approach, while at the same time having absolute guarantees that messages have successfully reached the server.
The window size for send acknowledgments is determined by the confirmation-window-size parameter on the connection factory or client session factory. refer to Chapter 32, Client Reconnection and Session Reattachment for more info on this.

18.4.1. Asynchronous Send Acknowledgments

To use the feature using the core API, implement the interface org.hornetq.api.core.client.SendAcknowledgementHandler and set a handler instance on your ClientSession.
Send messages as normal using your ClientSession, and as messages reach the server, the server will send back an acknowledgment of the send asynchronously. HornetQ calls your handler's sendAcknowledged(ClientMessage message) method, passing in a reference to the message that was sent.
To enable asynchronous send acknowledgments, make sure confirmation-window-size is set to a positive integer value (specified in bytes). For example, 10485760 (10 Mebibytes) .
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.