Adding Ordering Group Features in JBM 1.4
gaohoward Oct 6, 2008 2:11 AMhttps://jira.jboss.org/jira/browse/JBMESSAGING-1416
I'm trying to add this feature to JBM 1.4. Below is a draft design and I'm considering Tim's suggestion to make changes to our MessagingQueue to implement it. The implementation detail will be posted later as I need more time to understand our code. Please help to review and see if anything is wrong or missing.
I Enable Ordering Group by programming
JBossMessageProducer::setOrderingGroup(); //sys generated name
JBossMessageProducer::setOrderingGroup(String name); //user specified name
The two methods enable/disable the JBossMessageProducer to produce messages that belong to a named ordering group. Messages in a named ordering group will be processed strictly in the order they are produced (sent). Calling setOrderingGroup(null) will reset the producer to be a normal JMS producer.
Once thus set, the producer will set a reserved message property JBM_ORDERING_GROUP_ID to the name of the ordering group on each message sent through it.
JBossMessages that have this property set are treated as ordering group messages and those that have one same value form an ordering group.
Other Processing Rules of Ordering Group Messages
1. The order of delivery will not be affected by sort criteria, priority, or filters.
2. Only if one message has been processed (acked, committed, rolled back, expired) can next message be delivered.
3. Uncommitted or unacked Messages in one ordering group must be within the same JMSSession or same transaction.
4. The processing of ordering group messages applies to both Queues and Topics.
II Enable Ordering Group by Administration
1. A ConnectionFactory can be configured to have ordering group enabled by default, i.e. all producers created from this factory have ordering group enabled. The user can override the default ordering group settings on the producer later by calling setOrderingGroup() methods.
2. A Destination can be configured to have ordering group enabled by default, i.e., any messages sent to this destination will automatically set to belong to the configured default ordering group if they haven't already belonged to one.