20.4.3. 配置参数

您可以通过设置不同的参数来配置 HornetQ 大型消息:
在客户端使用 HornetQ Core API
如果在客户端使用 HornetQ Core API,您需要设置ServerLocator.setMinLargeMessageSize 参数来指定大型消息的最小尺寸。大型消息的最小尺寸(min-large-message-size)默认为 100KB。
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName()))

locator.setMinLargeMessageSize(25 * 1024);

ClientSessionFactory factory = HornetQClient.createClientSessionFactory();

为 Java Messaging Service (JMS) 客户配置服务器
如果您使用 Java Messaging Service (JMS),您需要通过服务器配置文件(standalone.xmldomain.xml)里的 min-large-message-size 属性指定大型消息的最小尺寸。大型消息的最小尺寸(min-large-message-size)默认为 100KB。

注意

min-large-message-size 属性的单位应该为字节。
您可以选择压缩大型消息以获得快速和高效的传输。所有的压缩/解压操作都是在客户端来处理的。如果压缩的消息比 min-large-message-size 要小,它将作为常规消息发送给服务器。如果使用 Java Messaging Service (JMS) ,您可以设置服务器定位器或连接工厂上的布尔型属性 compress-large-messages 为 "true" 来压缩大型消息。
<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>