此内容没有您所选择的语言版本。

18.4. Asynchronous Send Acknowledgments


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

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat