[rabbitmq-discuss] Binding to topic exchange with a negation wildcard
Dave Curylo
curylod at asme.org
Thu Sep 13 21:47:52 BST 2012
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.
I think I'd take a simple negation binding over a full regex if there are
performance implications. Negation bindings obviously would need to be
declared before other bindings or a match could be found before it got to
the negation, but I think that's reasonable - typical rules processing
works this way. It doesn't seem like with these types of negations would
have performance implications with the caveat that they must be earlier in
the list of bindings.
On Thu, Sep 13, 2012 at 10:53 AM, Laing, Michael P. <
Michael.Laing at nytimes.com> wrote:
> We would find a regular expression matching option for topic exchanges
> most useful.
>
> My 2 cents :)
>
> Michael
>
> On 9/13/12 4:40 AM, "Simon MacMullen" <simon at rabbitmq.com> wrote:
>
> >On 12/09/2012 8:37PM, Dave Curylo wrote:
> >> Is it possible to bind a queue to a topic exchange with a condition that
> >> the topic does NOT match a certain wildcard?
> >
> >The topic exchange doesn't have that logic. But you can fake it with the
> >alternate exchange feature, at the cost of a few more exchanges.
> >
> >Declare a fanout exchange you'll publish to (let's call it
> >"my-exchange"). Declare a fanout exchange called "junk".
> >
> >The when each consumer declares a queue, it also declares a topic
> >exchange and a fanout exchange. The alternate-exchange for the topic
> >exchange should be set to the fanout exchange. It then binds the topic
> >exchange to "my-exchange", and "junk" to the topic exchange, with a
> >routing key equal to the topics it doesn't want.
> >
> >Thus messages with the "bad" routing key go:
> >
> > [my-exchange] -> [per-consumer-topic] -> [junk]
> >
> >and the rest go:
> >
> > [my-exchange] -> [per-consumer-topic] -> [per-consumer-fanout] ->
> >[per-consumer-queue]
> >
> >I think that's the simplest you can make it. But exchanges are cheap in
> >general, it's just routing logic.
> >
> >But I wonder whether some sort of more explicit negation feature would
> >be feasible / useful. Hmm.
> >
> >Cheers, Simon
> >_______________________________________________
> >rabbitmq-discuss mailing list
> >rabbitmq-discuss at lists.rabbitmq.com
> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120913/664e4c6d/attachment.htm>
More information about the rabbitmq-discuss
mailing list