-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for JBoss Enterprise Application Platform Common Criteria Certification
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_ACKNOWLEDGE
mode results in theMessage
.acknowledge()
method signaling the completion state. - The
AUTO_ACKNOWLEDGE
andDUPS_OK_ACKNOWLEDGE
modes 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
9.1.1. Enabling with the API
JBossMessageProducer
as demonstrated in the following code sample:
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
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
9.1.2. Configuration Changes
EnableOrderingGroup;
- set this property to
true
to 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
<mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"; name="jboss.messaging.connectionfactory:service=ConnectionFactory"; xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml"> <depends optional-attribute-name="ServerPeer"> jboss.messaging:service=ServerPeer </depends> <depends optional-attribute-name="Connector"> jboss.messaging:service=Connector,transport=bisocket </depends> <depends> jboss.messaging:service=PostOffice </depends> <attribute name="JNDIBindings"> <bindings> <binding>/MyConnectionFactory</binding> <binding>/XAConnectionFactory</binding> <binding>java:/MyConnectionFactory</binding> <binding>java:/XAConnectionFactory</binding> </bindings> </attribute> <!-- This are the two properties --> <attribute name="EnableOrderingGroup">true</attribute> <attribute name="DefaultOrderingGroupName">MyOrderingGroup</attribute> </mbean>