You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by sreuland <sh...@ereuland.com> on 2011/12/02 18:58:25 UTC

are multiple values for a single key in x-match qpid address string possible?

Hello, I'm trying to create an x-match binding on a headers exchange(qpid
0.10) and it appears as though only the last value for a key is being taken,
for example here's the address string:

myqueue; {create: always,node: {type: queue, durable:'True',x-declare:
{auto-delete:'False', exchange:my_exch, type:headers},
x-bindings:[{queue:myqueue,exchange:'my_exch',arguments:{'x-match':any,'a':'10','a':'999'}}]}}

when sending messages to 'my_exch', only those with header a=999 get routed
to 'myqueue', it appears as though only the last key value in x-match is
taken, is there any way I can specify multiple values for the same key in a
single address string via x-match syntax? 

--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/are-multiple-values-for-a-single-key-in-x-match-qpid-address-string-possible-tp7055624p7055624.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


Re: are multiple values for a single key in x-match qpid address string possible?

Posted by Fraser Adams <fr...@blueyonder.co.uk>.
I don't think that you have to go as far as creating another queue.

I'm pretty sure that you can have multiple bindings to the same queue.

I *think* it would look something like this (taken from your earlier 
example), but I haven't tried it:

x-bindings:[{queue:myqueue,exchange:'my_exch',key: 'binding1', 
arguments:{'x-match':any,'a':'10'}}, 
{queue:myqueue,exchange:'my_exch',key: 'binding2', 
arguments:{'x-match':any,'a':'999'}}]

The above should be the equivalent of a match if a=10 or a=999, which is 
I think what you want.

The key: 'binding1' and key: 'binding2' bits I added aren't strictly 
necessary but if you don't have them then it's impossible to remove the 
bindings (using say qpid-config) without also removing the queue.

Frase


sreuland wrote:
> I see, so I have to create another queue such as 'myqueue2' with the binding
> for a=10. Thanks for quik reply!
>
> --
> View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/are-multiple-values-for-a-single-key-in-x-match-qpid-address-string-possible-tp7055624p7055792.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


Re: are multiple values for a single key in x-match qpid address string possible?

Posted by sreuland <sh...@ereuland.com>.
I see, so I have to create another queue such as 'myqueue2' with the binding
for a=10. Thanks for quik reply!

--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/are-multiple-values-for-a-single-key-in-x-match-qpid-address-string-possible-tp7055624p7055792.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


Re: are multiple values for a single key in x-match qpid address string possible?

Posted by Gordon Sim <gs...@redhat.com>.
On 12/02/2011 05:58 PM, sreuland wrote:
> Hello, I'm trying to create an x-match binding on a headers exchange(qpid
> 0.10) and it appears as though only the last value for a key is being taken,
> for example here's the address string:
>
> myqueue; {create: always,node: {type: queue, durable:'True',x-declare:
> {auto-delete:'False', exchange:my_exch, type:headers},
> x-bindings:[{queue:myqueue,exchange:'my_exch',arguments:{'x-match':any,'a':'10','a':'999'}}]}}
>
> when sending messages to 'my_exch', only those with header a=999 get routed
> to 'myqueue', it appears as though only the last key value in x-match is
> taken, is there any way I can specify multiple values for the same key in a
> single address string via x-match syntax?

Maps can only have one value per key. Even if the address allowed 
multiple values with the same key, the AMQP protocol wouldn't allow that 
to be sent across the wire. So unfortunately you cannot have multiple 
values for the same header in a single binding.

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