[rabbitmq-discuss] Message filtering

Emile Joubert emile at rabbitmq.com
Wed Aug 21 10:05:53 BST 2013


Hi,

On 21/08/13 02:07, Vikram Viswanathan wrote:
> I have a requirement where my rabbitmq consumer needs to receive 
> messages from a single queue based on a certain filtering criteria. 
> Something like a jms, where I can create a consumer based header 
> property of messages.

RabbitMQ does not support queue filtering. Messages can only be
retrieved from the head of the queue. The idea of retrieving all the
messages from a queue and rejecting non-matches is explicitly
discouraged in the protocol specification.

> I do not want this to be done by exchange routing key, because this 
> can mandate creating a large number of queues(I can possibly have a 
> million routing keys)
> 
> Is there a way to do it?

If you don't want a queue for each possible routing key you could aim
for an intermediate granularity. Or partition consumers by capability,
create a queue per partition and route messages according to the
capabilities required for processing.

> BTW, How much memory is allocated for each durable queue created in 
> the server ? Is there a way to tune this parameter ?

You can limit the memory a queue is likely to need by limiting the
length of the queue or the time that messages may spend in the queue:

http://www.rabbitmq.com/maxlength.html
http://www.rabbitmq.com/ttl.html





-Emile








More information about the rabbitmq-discuss mailing list