hmm. prefetch may be causing you some trouble, use prefetch=0 to ensure each receive asks the broker for the next highest priority message, otherwise a newly created high priority message could be backed up behind prefetched low priority ones.
Note the test for priority: org.apache.activemq.store.MessagePriorityTest http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java If you can provide some variation of that that that demonstrates a problem, we can easily look into it. Try a recent fuse release[1] or the current apache snapshot[2] or the 5.6 release candidate[3], all should suffice [1] http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/activemq/apache-activemq/5.5.1-fuse-04-01/ [2] https://repository.apache.org/content/repositories/snapshots/org/apache/activemq/apache-activemq/5.7-SNAPSHOT/ [3] https://repository.apache.org/content/repositories/orgapacheactivemq-025/org/apache/activemq/apache-activemq/5.6.0/ On 4 May 2012 11:02, nico <nico.roga...@gmail.com> wrote: > Hi there, > we are using activeMQ 5.5.2 as message broker for means of job distribution > across systems and as safeguard against failures. > > Now a new reqiurement rouse in the means of consuming messages in order of > their priority, so that important jobs are processed before unimportant > ones. > > Looking into the documentation and the all so often recited faq about "How > can I support priority queues?" it seems quite easy to just activate > priority message consuming with the boolean prioritizedMessages and a little > configuration on the publisher side to include priorities in your jms > messages. > But it doesn't work. Not as I would expect real priority message consuming > expect to be working, by always pulling the highest prioritized message out > of the queue. And looking into several blog entries and jira bugs it evens > shows that it's not even supposed to work. Maybe on a entry buffer level of > messages being ordered when they enter the queue simultaneously, but not > when they are persistet in the queue. > > So then I looked into the also stated "Alternatives" for priority message > consuming. > The Selector Approach doesn't suite our needs, cause we only have a little > number of consumers, that all have to process high and low priority jobs. > The Resequencer Approach sounded promising too, until I realized that it is > not intended to resequence messages within a queue, but just in the > transition from one queue to another. I implemented the 2 queues with > producer and consumer being connected by a BatchResequencer approach, but > that doesn't work very well. > The problem is this: say there are a 100 low priority messages and 1 high > priority message coming in in the first minute, the resequencer takes those > and writes them in the consumer queue with the high priority message being > first. Fine. But then in the seconde minute 50 more high priority messages > enter the producer queue. The Resequencer takes those messages and puts them > behind the low priorized messages in the consumer queue. So no more > priorization. One can of course play around with the timeouts and batch > sizes, but you will never reach "real priority message consuming" where a > higher priorized message is always consumed before a lower priorized > message. > > So I have two issues I would like to discuss: > 1. Does activeMQ support real prioritized message consuming, where a high > priority message is always consumed before a low prio message, even if they > entered the queue minutes apart? > 2. If it doesn't, why does the faq "How can I support priority queues?" > state that it does? I didn't see one Remark on there like "Oh and if you > mean 'high prio before low prio always' with message priority, then sorry no > we don't support that". > > btw: I know the JMS specification doesn't require priority messaging order, > or any order, but as I looked into hornetQ for example, they have a perfect > implementation of real message priority consuming. So it should be possible. > > Hope this wasn't too long for anyone to answer ;o) > Thanks in advance! > > Nico > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Real-Priority-Message-Consuming-in-ActiveMQ-tp4608262.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. -- http://fusesource.com http://blog.garytully.com