You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Chris Richardson <cr...@fourc.eu> on 2014/05/29 22:06:44 UTC

All Fruit Except Peaches (aka: "not" expressions in binding keys)

Hi,

Back in Sept 2011 Frase and Gordon had a discussion concerning negative
expressions in binding keys (
http://mail-archives.apache.org/mod_mbox/qpid-users/201109.mbox/%3C4E647F62.5020205%40redhat.com%3E
)

The conclusion was that it's not possible and that an xml exchange might
provide the required functionality.

I would like this feature for a topic exchange (the discussion above
concerned specifically header exchanges) and wonder if the situation is
still the same? I have not been able to find any other trace of this being
done/documented.

Failing the option of negative matching, a workaround I can think of is to
route all messages to a "triage" topic exchange, read all messages I
_don't_ want to a queue which will simply discard them, then use the
"alternate_exchange" option to route any remaining messages (the ones I
want) to another exchange where they can be managed as required... however
this setup seems a bit of a kludge.

Many thanks

Chris

-- 

*Chris Richardson*, System Architect
cr@fourc.eu


*FourC AS, Vestre Rosten 81, Trekanten, NO-7075 Tiller, Norwaywww.fourc.eu
<http://www.fourc.eu/>*

*Follow us on LinkedIn <http://bit.ly/fourcli>, Facebook
<http://bit.ly/fourcfb>, Google+ <http://bit.ly/fourcgp> and Twitter
<http://bit.ly/fourctw>!*

Re: All Fruit Except Peaches (aka: "not" expressions in binding keys)

Posted by Fraser Adams <fr...@blueyonder.co.uk>.
On 29/05/14 21:06, Chris Richardson wrote:
> Hi,
>
> Back in Sept 2011 Frase and Gordon had a discussion concerning negative
> expressions in binding keys (
> http://mail-archives.apache.org/mod_mbox/qpid-users/201109.mbox/%3C4E647F62.5020205%40redhat.com%3E
> )
>
> The conclusion was that it's not possible and that an xml exchange might
> provide the required functionality.
>
> I would like this feature for a topic exchange (the discussion above
> concerned specifically header exchanges) and wonder if the situation is
> still the same? I have not been able to find any other trace of this being
> done/documented.
>
> Failing the option of negative matching, a workaround I can think of is to
> route all messages to a "triage" topic exchange, read all messages I
> _don't_ want to a queue which will simply discard them, then use the
> "alternate_exchange" option to route any remaining messages (the ones I
> want) to another exchange where they can be managed as required... however
> this setup seems a bit of a kludge.
>
> Many thanks
>
> Chris
>
Hi Chris,
The situation has change somewhat for the better. As of Qpid 0.20 (I 
think) the concept of Message Selectors was introduced to Qpid. If you 
are familiar with JMS then it's pretty much an implementation of the JMS 
Message Selector specification, but it applies to qpidd and the Java 
Broker and works for all the qpid clients not just JMS (so you can use 
it with C++ apps too).

The filters are applied broker side and in conjunction with any exchange 
too so you can have very sophisticated filtering, for example you could 
publish to a topic exchange and subscribe to different subjects and 
apply different filters on top of that if you so choose.


There's currently not a vast amount of documentation, so I've attached a 
write up of my own experiments that I did whilst trying to get my head 
around the differences between AMQP 0.10 and AMQP 1.0 most of this 
relates to AMQP 1.0, but selectors will work with 0.10 too - though the 
syntax would be the same, that is to say selectors are applied as 
filters on the link configuration.

The second thing I attached might be interesting too. A chap called 
Clive posted a little while back trying to subscribe to different topics 
off a single queue, in general you can't do that - you normally have 
subscription queues following an exchange binding, however with message 
selectors because they are related to the links you can actually achieve 
this (though it's not something I'd personally do).


The attached documents are pretty long, but hopefully they should give 
you everything you need and more. I really need to make some time to 
make the info more coherent and publish it properly - it'd be great if 
you could let me know if it turns out to be useful - or if it's just TL;DR

HTH,
Frase