Again, any comments will be greatly appreciated. :)
Basic impl idea is we treat the ordering group messages as one container message, when
such a message is added to a queue, it will be added in the memory message list
(PriorityLinkedList). The difference is, rather than occupies a normal entry in the list,
it will be added into its containing OrderingGroup (which looks like just a normal entry
in the PriorityLinkedList). During the delivery time, all OrderingGroup entries in the
List will be handled specially by handleOrderingGroup() method of RoundRobinDistributor.
Details below:
Tasks defined for jbm ordering group
Note: We'll first implement the programming model for the feature and then consider
the configuration stuff.
1 - JBossMessageProducer changes
Add:
public void enableOrderingGroup(String ogrpName) throws JMSException
public void disableOrderingGroup();
Modify:
sending methods -- if ordering group enabled, add two properties to message
JBM_ORDERING_GROUP_ID -- either user specified or auto-generated
JBM_ORDERING_GROUP_SEQ -- a long value indicate the order they are produced.
Validations on messages to be sent may be done here to see if the message's header or
properties is valid for an ordering group.
2 - session wide help methods
Add:
public String genOrderingGroupID();
-- generate unique group ids for ordering group (maybe reuse existing uuid util in jbm,
enough to be session wide unique)
public long getGroupSequenceNum();
-- generate message processing sequence number.
3 - OrderingGroup class - a special message that contains messages belonging to a group
Add:
//just as a message with normal message priority
public class OrderingGroup extends MessageReference
{
private:
String groupID;
List orderedMessages; //or maybe a class to manage it.
public:
MessageReference nextRef(); //this method will wait for the completion of the current
one.
}
//RoundRobinDistributor::handleOrderingGroup()
//this methold guarantees the ordered delivery for a message ordering group.
//the main logic will go here
public Delivery handleOrderingGroup(DeliveryObserver observer, OrderingGroup ref,
Transaction tx)
Change:
BasicPriorityLinkedList class
enable the list to allow ordering group to be added as one prioritized object. After
change, the list should be like:
M1, M2, ... Mn{Mg1, Mg2, ...}, Mn+1
where Mn{...} represents a OrderingGroup object, while other Ms represents a normal
MessageReference
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180947#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...