Curtis Paris
2003-12-22 21:32:16 UTC
I currently have implemented priority based Queuing into the OpenJMS
system. But, I'm struggling with the best way to have a client define
it's priority. There is no obvious way in JMS, that I can see, to pass
an attribute for each Queue. I would rather not do it on a ClientID
basis, since it may be applicable that some clients need to have a
higher priority in one queue, and a lower priority in another (including
in my environment). As soon as I can get a best practice for
specifying the client priority, I'll be happy to send in my code to the
OpenJMS project
To give you an idea of what the priority queuing does, here we go:
A client creates a queue connection, and specifies its priority (agian,
any ideas on best practices?). Priorities are defined as a byte.
QueueDestinationCache will look for people to handle the message by:
- Top to Bottom Priorioty
- Round Robin Servers for each priority (keeping track of the
last server # for each priority level).
Example, if I had five clients:
#1 - Priority of 200
#2 - Priority of 200
#3 - Priority of 100
#4 - Priority of 100
#5 - Priority of 50
* It will round robin and check to see if client #1 or #2 can
select the message and are ready for it (checking all highest priority
servers first)
* If not, it will round robin and check to see if Client #3 or #4
can select the message and are ready for it.
* If not, it will round robin #5 and check to see if client #5 can
select the message and is ready for it.
* If not, queue the message for later delivery.
Clients can not change their priority unless the unregister and
reregister. (Although it would be simple enough to have
registerConsumer() handle this appropriately.
My only thought on how to do this would be to extend the selection
critereon. For example:
Currently: MyHeader > 5
Attributed: {Priority=5} MyHeader > 5
When the client is connected, it will parse out attributes in {}'s.
It'll then release the rest of it for the normal parser.
_____
Curtis Paris
Software Engineer IV
Metro One Telecommunications, Inc.
11200 Murray Scholls Place
Beaverton, OR 97007 Phone: +1 (503) 643-9500
Fax: +1 (503) 643-9600
E-Mail: ***@metro1.com
Web: http://www.metro1.com/
system. But, I'm struggling with the best way to have a client define
it's priority. There is no obvious way in JMS, that I can see, to pass
an attribute for each Queue. I would rather not do it on a ClientID
basis, since it may be applicable that some clients need to have a
higher priority in one queue, and a lower priority in another (including
in my environment). As soon as I can get a best practice for
specifying the client priority, I'll be happy to send in my code to the
OpenJMS project
To give you an idea of what the priority queuing does, here we go:
A client creates a queue connection, and specifies its priority (agian,
any ideas on best practices?). Priorities are defined as a byte.
QueueDestinationCache will look for people to handle the message by:
- Top to Bottom Priorioty
- Round Robin Servers for each priority (keeping track of the
last server # for each priority level).
Example, if I had five clients:
#1 - Priority of 200
#2 - Priority of 200
#3 - Priority of 100
#4 - Priority of 100
#5 - Priority of 50
* It will round robin and check to see if client #1 or #2 can
select the message and are ready for it (checking all highest priority
servers first)
* If not, it will round robin and check to see if Client #3 or #4
can select the message and are ready for it.
* If not, it will round robin #5 and check to see if client #5 can
select the message and is ready for it.
* If not, queue the message for later delivery.
Clients can not change their priority unless the unregister and
reregister. (Although it would be simple enough to have
registerConsumer() handle this appropriately.
My only thought on how to do this would be to extend the selection
critereon. For example:
Currently: MyHeader > 5
Attributed: {Priority=5} MyHeader > 5
When the client is connected, it will parse out attributes in {}'s.
It'll then release the rest of it for the normal parser.
_____
Curtis Paris
Software Engineer IV
Metro One Telecommunications, Inc.
11200 Murray Scholls Place
Beaverton, OR 97007 Phone: +1 (503) 643-9500
Fax: +1 (503) 643-9600
E-Mail: ***@metro1.com
Web: http://www.metro1.com/