qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fraser Adams <fraser.ad...@blueyonder.co.uk>
Subject Re: Headers message filtering
Date Thu, 12 Jan 2012 20:02:37 GMT
Hi there,
It looks to me like your address syntax is wrong.

A destination that I tend to use for playing around with the headers 
exchange is:

testqueue; {create: receiver, node: {x-declare: {arguments: 
{'qpid.policy_type': ring, 'qpid.max_size': 500000000}}, x-bindings: 
[{exchange: 'amq.match', queue: 'testqueue', key: 'data1', arguments: 
{x-match: all, data-service: amqp-delivery, item-owner: fadams}}]}}

that address creates a binding with a key called data1 (for headers 
exchange the key is really just a handle) and the binding matches if the 
header data-service=amqp-delivery and the header item-owner=fadams. The 
x-match: all means that every header must match -e.g. it's effectively a 
logical AND.

your x-bindings say

x-bindings:[{queue:generated, exchange:myexchange, arguments:{'x-match':matchkey,'type':'matchvalue'}}]

the value of x-match should be all or any so at the very least that bit 
is wrong.

I'm afraid I'm not that familiar with spout and drain so I wouldn't know 
if you've got the right syntax for that I'm afraid.

As I say the address I've given you definitely works for the properties 
mentioned so one option is to start from there and change the values for 
what you actually need.

As an aside rather frustratingly qpid-config - b queues isn't that 
useful for the headers exchange (it just displays the binding key and 
not the arguments). Gordon Sim put together a patch, hopefully it's on 
track to make it in to Qpid 0.14 (it's only a four line change and is 
really useful for anyone who used the headers exchange)


On 12/01/12 18:39, techguy911 wrote:
> I'm trying to filter by message properties using a headers exchange but no
> luck.  To help with troubleshooting, I broke the problem down to standard
> QPID command lines.
> #Create the exchange
> qpid-config add exchange headers myexchange
> #Bind to a queue with a property filter
> qpid-config bind myexchange myqueue mykey all matchkey=matchvalue
> #In terminal A, setup a non-filtered test drain
> ./drain -f myexchange
> #In terminal B, setup a drain on the bound queue
> ./drain -f myqueue
> #In terminal C, setup an auto-generated queue bound to the exchange
> ./drain -f "generated; {create:always, node: {type: queue,
> x-declare:{auto-delete:'False', exchange:myexchange, type:headers},
> x-bindings:[{queue:generated, exchange:myexchange,
> arguments:{'x-match':matchkey,'type':'matchvalue'}}]}}"
> #In terminal D, send the message
> ./spout --content "testcontent" --property "matchkey=matchvalue" myexchange
> I see messages coming across on Terminal A
> Message(properties={matchkey:matchvalue,
> spout-id:eef6a0ea-a21b-42db-8dac-7deafd40fceb:0, x-amqp-0-10.routing-key:},
> content='testcontent')
> Nothing on B or C.
> --
> View this message in context: http://qpid.2158936.n2.nabble.com/Headers-message-filtering-tp7181185p7181185.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org

View raw message