"hegsti" wrote : Hi, I'm trying to do my first contribution to JBoss
Messaging so be nice :)
| I worked on a project last year where message groups (messages with the same group id
always go to the same consumer on a queue).
| would have been really useful. I just finished a working proof of concept, which I
hope to complete with help and feedback.
|
Great. Message groups are a nice feature that have been on our road map for some time.
http://jira.jboss.com/jira/browse/JBMESSAGING-375
anonymous wrote :
| To continue to support the default round robin routing when JMSXGroupID is not
supplied, I modified the existing RoundRobinPointToPointRouter to route based on given
JMSXGroupID when supplied.
|
I agree it should be based on the RoundRobinRouter, but I would prefer to see it
implemented in its own class e.g. GroupingRoundRobinPointToPointRouter. Maybe you can
extend RoundRobinPointToPointRouter?
anonymous wrote :
| The Delivery handle(...) now behaves like this:
| ..
| ..
| get the reciver by round robin. if a groupId is given, try to see if a receiver is
already assigned to handle this group.
| If it is, use this to deliver.
| Else bind the receiver given by round robin to the groupId in the message.
| deliver using this receiver.
|
| If the receiver is broken, remove the binding between the current receiver and the
groupId.
|
| Where does the message go, if the receiver is broken?
| ...
| ...
|
| This approach will ensure that round robin works as before, and that each consumer
will have an equal chance to be bound to spesific groups. If a receiver is broken, the
mapping will be removed and a new receiver will be selected to handle the group.
|
|
Ok, makes sense.
anonymous wrote :
| To support a large number of groups in an efficient way, I decided not to use some
kind of map which grows for each new group that needs a mapping to a receiver.
|
Personally I would just use a HashMap. HashMaps work on pretty much the same principle as
you are suggesting anyway: I.e. they maintain an array and use the hashCode to detemine
the lookup in the array - also they manage their own resizing so you don't have to
worry about it.
I would be surprised if a HashMap was much slower than what you are suggesting.
I would be careful of doing premature optimisations.
Thanks Stian
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048447#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...