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

18.4. Work with Large Messages


18.4.1. Work with Large Messages

HornetQ supports the use of large messages even when either the client or server has limited amounts of memory. Large messages can be streamed as they are, or compressed further for more efficient transferral. A user can send a large message by setting an InputStream in the body of the message. When the message is sent HornetQ reads this InputStream and transmits data to the server in fragments.
The client or the server never store the complete body of a large message in memory. The consumer initially receives a large message with an empty body and thereafter sets an OutputStream on the message to stream it in fragments to a disk file.

18.4.2. Configuring HornetQ Large Messages

Configuring the Server

In Standalone mode large messages are stored in EAP_HOME/standalone/data/largemessages directory. In Domain mode large messages are stored in EAP_HOME/domain/servers/SERVERNAME/data/largemessages directory. The configuration property large-messages-directory indicates the location where large messages are stored.

Important

To achieve best performance, we recommend storing the large messages directory on a different physical volume to the message journal or the paging directory

18.4.3. Configuring Parameters

You can configure HornetQ large messages by setting various parameters:
Using HornetQ Core API on Client Side
If you are using HornetQ Core API on client side you need to set ServerLocator.setMinLargeMessageSize parameter to specify minimum size of large messages. The minimum size of large messages(min-large-message-size) is set to 100KiB by default.
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName()))

locator.setMinLargeMessageSize(25 * 1024);

ClientSessionFactory factory = HornetQClient.createClientSessionFactory();

Copy to Clipboard Toggle word wrap
Configuring server for Java Messaging Service (JMS) clients
If you using Java Messaging Service (JMS) you need to specify the minimum size of large messages in the attribute min-large-message-size of your server configuration files (standalone.xml and domain.xml). The minimum size of large messages(min-large-message-size) is set to 100KiB by default.

Note

The value of the attribute min-large-message-size should be in bytes
You may choose to compress large messages for fast and efficient transfer. All compression/de-compression operations are handled on client side. If the compressed message is smaller than min-large-message-size,it is sent to the server as a regular message. Using Java Messaging Service (JMS) you can compress large messages by setting the boolean property compress-large-messages "true" on the server locator or ConnectionFactory.
<connection-factory name="ConnectionFactory">
   <connectors>
      <connector-ref connector-name="netty"/>
   </connectors>
...
   <min-large-message-size>204800</min-large-message-size>
   <compress-large-messages>true</compress-large-messages>
</connection-factory>

Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat