20.9.3. Configuring Server for Java Messaging Service (JMS) Clients

The property JMSXGroupID is used to identify a message group for Java Messaging Service (JMS) clients. If you wish to send a message group with different messages to one consumer you can set the same JMSXGroupID for different messages:
 Message message = ...
 message.setStringProperty("JMSXGroupID", "Group-0");
 producer.send(message);

 message = ...
 message.setStringProperty("JMSXGroupID", "Group-0");
 producer.send(message);
The second approach is to set the autogroup property as "true" on the HornetQConnectonFactory. The HornetQConnectionFactory will then pick up a random unique message group id. You can set the autogroup property in server configuration files (standalone.xml and domain.xml) as follows:
<connection-factory name="ConnectionFactory">
   <connectors>
      <connector-ref connector-name="netty-connector"/>
   </connectors>
   <entries>
      <entry name="ConnectionFactory"/>
   </entries>
   <autogroup>true</autogroup>
</connection-factory>
An alternative to the above two approaches is to set a specific message group id through the connection factory. This will in-turn set the property JMSXGroupID to the specified value for all messages sent through this connection factory. To set a specific message group id on the connection factory, edit the group-id property in server configuration files (standalone.xml and domain.xml) as follows:
<connection-factory name="ConnectionFactory">
   <connectors>
      <connector-ref connector-name="netty-connector"/>
   </connectors>
   <entries>
      <entry name="ConnectionFactory"/>
   </entries>
   <group-id>Group-0</group-id>
</connection-factory>