[rabbitmq-discuss] Binding to topic exchange with a negation wildcard

Matthias Radestock matthias at rabbitmq.com
Thu Sep 13 22:18:55 BST 2012


Dave,

On 13/09/12 21:47, Dave Curylo wrote:
> The fanout + alternate-exchange for junk works, except I can't make
> these extra exchanges exclusive like I can when declaring a server
> assigned, exclusive, autodelete queue with queueDeclare(). That's
> probably not a big deal, as nobody would likely guess the names of these
> extra exchanges.

If you make the names cryptographically strong names then nobody can 
guess them.

> I think I'd take a simple negation binding over a full regex if there
>  are performance implications. [...] It doesn't seem like with these
> types of negations would have performance implications.

Firstly, the semantics of multiple bindings with the same destination is 
that of disjunction - the message is routed to the destination if it 
matches one or more of the bindings. By contrast, what you seem to want 
is a conjunction of negations. Or, equivalently, a negated disjunction. 
I suppose the later could be expressed as a single binding, using 
binding parameters to hold all the constituent parts, but it would be 
far from natural.

Secondly, we don't store bindings in a list. There is a fairly 
sophisticated data structure and algorithm underpinning the topic 
matching. See

http://www.rabbitmq.com/blog/2010/09/14/very-fast-and-scalable-topic-routing-part-1/

and

http://www.rabbitmq.com/blog/2011/03/28/very-fast-and-scalable-topic-routing-part-2/

I am pretty sure negation doesn't fit in there and indeed I wouldn't be 
surprised to discover that introducing negation results in a theoretical 
matching complexity of O(binding_count).


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list