activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: are dispatch policies also made for queues?
Date Tue, 17 Apr 2007 09:11:06 GMT
On 4/17/07, Daniel Gradecak <> wrote:
> Hello,
> I would like to dispatch messages to queue "listeners (receivers)" with
> different policies. As it is guaranteed for topics (
> ),

Total ordering only applies to topics because messages are sent to all
consumers interested. This isn't relevant to a queue, since there is
only one queue, so things can't get out of order.

> I would like to plug some policies such as "less messages read" for
> example, meaning that the message will be delivered to a receiver that
> has read the less messages.

The use of prefetch buffers means that this is how ActiveMQ works already.

> Is that also possible to know if a receiver is ready to receive the next
> message? For example imagine that there is 10 messages in the queue and
> there is only 2 receivers,
> receiver 1 gets a message and untill the session is not commited or
> rolledback, the receiver 1 should not get any other messages. Is it
> possible with ActiveMQ and does it make sense to you guys?

It makes total sense. If you set the prefetch buffer to 1; then you
will get exactly the behaviour you require (though it'll be a bit slow
under high message load). The defaults are 1000 for queues, which is
the best value for high performance dispatching; but it tends to not
give a very fair load balancing under small numbers of messages.

> Another question is, if activemq alows to somehow reorder a queue? Lets
> say, there is 10 messages agin in the queue, and someone (an admin guy)
> sees there is a message from a VIP
> client, and says O.K, this messages needs to go on the top of the queue.

Use selectors; they kinda reorder the queue, allowing you to subscribe
to just what you want (such as VIP messages). So you could have say 10
consumers for all messages and 20 consumers for just VIP messages.

> Please help me to sort this out, because i can not find this in the docs.

FWIW there's some interesting stuff in the FAQ if you noodle around;
though it is a bit hard to know where to start


View raw message