You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Noel OConnor <no...@gmail.com> on 2012/10/04 08:58:43 UTC

Binding queue to Header exchange with 'any' qualifier

Hi,
I'm using MRG-M 2.2 and I'm trying to configure a header exchange to use
the any qualifier

I have setup a header exchange and a queue and I'm trying to bind it using
the command

/usr/bin/qpid-config bind test_hdr_exchange noctestQ BK3 any
STATUSPROP=ONLINEACTIVITY STATUSPROP=CAMPAIGNRESPONSE

and I drain the queue
using /usr/share/doc/python-qpid-0.14/examples/api/drain -f noctestQ

Using a JMS client running on AS7 when I send in a jms text message of

MessageProperties(contentLength=85,
messageId=fd2b91eb-9a53-393f-bba7-81c3e5968b5c, contentType=text/plain,
userId=[B@33e82057, applicationHeaders={STATUSPROP=CAMPAIGNRESPONSE,
qpid.subject=})

the drain command outputs
Message(id=UUID('fd2b91eb-9a53-393f-bba7-81c3e5968b5c'), subject=u'',
user_id='anonymous', priority=4, durable=True,
properties={'x-amqp-0-10.timestamp': timestamp(1349333278917.0),
u'qpid.subject': u'', u'STATUSPROP': u'CAMPAIGNRESPONSE',
'x-amqp-0-10.routing-key': u''}, content=u'This is a message from a servlet
org.apache.catalina.connector.RequestFacade@7b1d410d')

However when I send in a jms text message of
MessageProperties(contentLength=85,
messageId=c21af470-238c-38e2-8276-dbd9ae4eebfb, contentType=text/plain,
userId=[B@23e5d50a, applicationHeaders={STATUSPROP=ONLINEACTIVITY,
qpid.subject=})

Drain doesn't output anything.

I've tried using the comma separator with spaces e.g. /usr/bin/qpid-config
bind optus_hdr_exchange noctestQ BK3 any STATUSPROP=ONLINEACTIVITY ,
STATUSPROP=CAMPAIGNRESPONSE    but I get a Failed: IndexError: list index
out of range

I've also tried the above without a space before the comma but once again
the only the messages with CAMPAIGNRESPONSE set are output.

Any idea what I'm doing wrong ?

Re: Binding queue to Header exchange with 'any' qualifier

Posted by Noel OConnor <no...@gmail.com>.
Thanks for this Gordon, I'll try it out.

regards
Noel

On Fri, Oct 5, 2012 at 4:51 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 10/04/2012 07:58 AM, Noel OConnor wrote:
>
>> Hi,
>> I'm using MRG-M 2.2 and I'm trying to configure a header exchange to use
>> the any qualifier
>>
>> I have setup a header exchange and a queue and I'm trying to bind it using
>> the command
>>
>> /usr/bin/qpid-config bind test_hdr_exchange noctestQ BK3 any
>> STATUSPROP=ONLINEACTIVITY STATUSPROP=CAMPAIGNRESPONSE
>>
>
> Unfortunately that is not a valid binding. The match arguments are passed
> in an AMQP 'map', and they are defined not to have multiple entries per key.
>
> So in this case, the only match that is sent to the broker is
> STATUSPROP=CAMPAIGNRESPONSE, whicheffectively overwrites the previous value
> for that key.
>
> You could try the 'XML' exchange - you don't need to use XML in your
> messages, you can simply use it as a way of specifying xquery based
> matching criteria on the headers.
>
> E.g.
>
> qpid-config add exchange xml xml_exchange
> qpid-config add queue queue
> qpid-config bind xml_exchange queue -f xquery.example
>
> where the file xquery.example contains e.g:
>
> declare variable $STATUS_PROP as xs:string external;
> $STATUS_PROP = 'ONLINEACTIVITY' or $STATUS_PROP = 'CAMPAIGNRESPONSE'
>
> Then:
>
> spout -P STATUS_PROP=CAMPAIGNRESPONSE xml_exchange 'this should match'
> spout -P STATUS_PROP=ONLINEACTIVITY xml_exchange 'as should this'
> spout -P STATUS_PROP=RANDOMGARBAGE xml_exchange 'this should not match'
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<us...@qpid.apache.org>
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Binding queue to Header exchange with 'any' qualifier

Posted by Gordon Sim <gs...@redhat.com>.
On 10/04/2012 07:58 AM, Noel OConnor wrote:
> Hi,
> I'm using MRG-M 2.2 and I'm trying to configure a header exchange to use
> the any qualifier
>
> I have setup a header exchange and a queue and I'm trying to bind it using
> the command
>
> /usr/bin/qpid-config bind test_hdr_exchange noctestQ BK3 any
> STATUSPROP=ONLINEACTIVITY STATUSPROP=CAMPAIGNRESPONSE

Unfortunately that is not a valid binding. The match arguments are 
passed in an AMQP 'map', and they are defined not to have multiple 
entries per key.

So in this case, the only match that is sent to the broker is 
STATUSPROP=CAMPAIGNRESPONSE, whicheffectively overwrites the previous 
value for that key.

You could try the 'XML' exchange - you don't need to use XML in your 
messages, you can simply use it as a way of specifying xquery based 
matching criteria on the headers.

E.g.

qpid-config add exchange xml xml_exchange
qpid-config add queue queue
qpid-config bind xml_exchange queue -f xquery.example

where the file xquery.example contains e.g:

declare variable $STATUS_PROP as xs:string external;
$STATUS_PROP = 'ONLINEACTIVITY' or $STATUS_PROP = 'CAMPAIGNRESPONSE'

Then:

spout -P STATUS_PROP=CAMPAIGNRESPONSE xml_exchange 'this should match'
spout -P STATUS_PROP=ONLINEACTIVITY xml_exchange 'as should this'
spout -P STATUS_PROP=RANDOMGARBAGE xml_exchange 'this should not match'


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org