Chapter 9. Enabling JBoss Messaging Ordering Group
The messages that form a part of an ordering group are delivered one at a time. The next message will not be delivered until the delivery of a previous message is completed. Message delivery completion is signaled by various means, depending on the acknowledge mode settings;
- The
CLIENT_ACKNOWLEDGEmode results in theMessage.acknowledge()method signaling the completion state. - The
AUTO_ACKNOWLEDGEandDUPS_OK_ACKNOWLEDGEmodes result in the completion of the message being identified by either of the following;- a successful return from one of the
MessageConsumer.receive()methods, or - a successful return from the
onMessage()call of theMessageListener().
Note
*_ACKNOWLEGE is called prior to the closure of the consumer.
In the case of the transactional receipt of messages, the next message will not be delivered until the transaction has been committed which includes the acknowledgment of the receipt of the current message. If the transaction is rolled back, the message will be canceled, sent back to the JMS server and made available for the next delivery.
9.1. How to Enable Message Ordering Group Copy linkLink copied to clipboard!
9.1.1. Enabling with the API Copy linkLink copied to clipboard!
JBossMessageProducer as demonstrated in the following code sample:
JBossMessageProducer producer=(JBossMessageProducer)session.createProducer(queue);
JBossMessageProducer producer=(JBossMessageProducer)session.createProducer(queue);
The following code sample demonstrates how to create an ordering group with the name ogrpName.
public void enableOrderingGroup(String ogrpName) throws JMSException
public void enableOrderingGroup(String ogrpName) throws JMSException
null parameter is supplied, the name of the ordering group will be automatically generated. Calling this method more than once will override any previous method calls.
The following code samples demonstrates how to stop producing ordering group messages.
public void disableOrderingGroup() throws JMSException
public void disableOrderingGroup() throws JMSException
9.1.2. Configuration Changes Copy linkLink copied to clipboard!
EnableOrderingGroup;- set this property to
trueto enable the ordering group feature. The default value for this property isfalse.
DefaultOrderingGroupName;- the default name for the message ordering group. The group name will be generated automatically if this attribute is missing.
Note