Questo contenuto non è disponibile nella lingua selezionata.

Chapter 22. Message Grouping


A message group is a group of messages that share certain characteristics:

  • All messages in a message group are grouped under a common group ID. This means that they can be identified with a common group property.
  • All messages in a message group are serially processed and consumed by the same consumer, irrespective of the number of customers on the queue. This means that a specific message group with a unique group id is always processed by one consumer when the consumer opens it. If the consumer closes the message group, then the entire message group is directed to another consumer in the queue.

Message groups are especially useful when there is a need for messages with a certain value of the property, such as group ID, to be processed serially by a single consumer.

Important

Message grouping will not work as expected if the queue has paging enabled. Be sure to disable paging before configuring a queue for message grouping.

For information about configuring message grouping within a cluster of messaging servers, see Clustered Message Grouping in Part III, Configuring Multiple Messaging Systems.

22.1. Configuring Message Groups Using the Core API

The property _AMQ_GROUP_ID is used to identify a message group using the Core API on the client side. To pick a random unique message group identifier, you can also set the auto-group property to true on the SessionFactory.

22.2. Configuring Message Groups Using JMS

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);
Copy to Clipboard Toggle word wrap

An alternative approach is to use the one of the following attributes of the connection-factory to be used by the client: auto-group or group-id.

When auto-group is set to true, the connection-factory will begin to use a random unique message group identifier for all messages sent through it. You can use the management CLI to set the auto-group attribute.

/subsystem=messaging-activemq/server=default/connection-factory=RemoteConnectionFactory:write-attribute(name=auto-group,value=true)
Copy to Clipboard Toggle word wrap

The group-id attribute will set the property JMSXGroupID to the specified value for all messages sent through the connection factory. To set a specific group-id on the connection factory, use the management CLI.

/subsystem=messaging-activemq/server=default/connection-factory=RemoteConnectionFactory:write-attribute(name=group-id,value="Group-0")
Copy to Clipboard Toggle word wrap
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat