Hi I have never used consumer priorities, but the amq-website says about it *** Once a particular consumer has its prefetch buffer filled up, the broker will begin to dispatch messages to consumers of lower priorities. ***
So, the behaviour you describe seems to be ok to me. When the high prio consumer has prefetched and is working, the broker begins to dispatch to other consumers. If you want to avoid parallel consumers at all, you are on the right track with exclusive consumer. In such a setup all messages are going to same consumer. But for most use-cases message-groups are a better solution than exclusive consumer since it allows parallel consumers and "synchronizes" only the relevant message groups on one consumer. http://activemq.apache.org/message-groups.html Regards Stephan On Tue, May 3, 2016 at 3:58 PM, Waqas Rana <waqaskhan...@gmail.com> wrote: > Hi all, > We are using ActiveMq in our application. We need to implement priority > consumer mechanism on the queue. We have multiple consumers and we want to > treat them as master/slave. So, the master consumer would have higher > priority and will consume all messages and once master gets down then the > consumer (with higher priority) will consume all requests from the queue. > > To Implement this scenario, we came across the mechanism of priority > queues. So, we initialized the queues by this way: > > javax.jms.Queue queue = queueSession.createQueue("myQueue" + > "?consumer.priority=" + 127); > > and remaining slaves nodes were assigned lesser priorities. > > But this mechanism is not working expectedly, sometimes it works fine that > we get all requests on the consumer with the highest priority but sometimes > consumer with lesser priority also start consuming messages while the > consumer with the highest priority is working fine. > > We have tried it with consumer.exclusive=true the option as well, with no > luck. > > *Note:* We are running all components (ActiveMQ, producer and consumer > application) locally on the same machine for now, so no network delays > involved. And we are running consumers with default prefetch policy. > > Is there any other approach to implementing this scenario using activeMq or > are we missing any configuration. > -- > > Best Regard, > Rana Muhammad Waqas >