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 2015/05/22 13:13:06 UTC

Property names in subscription selectors

Hi,

I'm trying to use a selector based on the information in this post:
http://grokbase.com/p/qpid/users/136t684en1/message-selection-filtering-using-c-client-with-the-java-broker

except I'm using the C++ broker (and client) 0.32.

The selector seems to work with the following syntax:
 "my-queue; {link:{selector:\"myproperty='property-value'\"}}"

but if I try to use a message property which contains a hyphen, it does
not. Eg.
"my-queue; {link:{selector:\"my-property='property-value'\"}}"
matches nothing, even though the property exists in the message complete
with a hyphen in the name.

I guess this is a restriction imposed by the property name being required
to be a java identifier?

Is there any way around this, or another method/syntax I could use to
filter messages by property value in my queue subscription?

Any advice much appreciated.

-- 

*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: Property names in subscription selectors

Posted by Gordon Sim <gs...@redhat.com>.
On 05/22/2015 05:09 PM, Andrew Stitcher wrote:
>
>> The selector syntax as recognised by the broker requires the property
>> identifier to be enclosed in double quotes, but the value to be
>> enclosed
>> in single quotes.
>>
>> However the qpid::messaging client's address parsing does not handle
>> any
>> escaping of quotes, so that combination of both double and single
>> quoted
>> parts in a property value isn't possible.
>
> We should create a JIRA to record this issue - it's not something that
> occurred to me when I added the new syntax.

https://issues.apache.org/jira/browse/QPID-6553, feel free to edit etc


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


Re: Property names in subscription selectors

Posted by Andrew Stitcher <as...@redhat.com>.
>The selector syntax as recognised by the broker requires the property 
> identifier to be enclosed in double quotes, but the value to be
> enclosed 
> in single quotes.
> 
> However the qpid::messaging client's address parsing does not handle
> any 
> escaping of quotes, so that combination of both double and single
> quoted 
> parts in a property value isn't possible.

We should create a JIRA to record this issue - it's not something that
occurred to me when I added the new syntax.

Andrew



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


Re: Property names in subscription selectors

Posted by Chris Richardson <cr...@fourc.eu>.
On 22 May 2015 at 13:57, Gordon Sim <gs...@redhat.com> wrote:

> On 05/22/2015 12:38 PM, Chris Richardson wrote:
>
>> No-go unfortunately:
>>   Error: Unmatched '{'!, character 28 of my-queue;
>> {link:{selector:""my-property"='property-value'"}}
>>
>> I've tried single quotes as well but that doesn't seem to help.
>>
>
> The selector syntax as recognised by the broker requires the property
> identifier to be enclosed in double quotes, but the value to be enclosed in
> single quotes.
>
> However the qpid::messaging client's address parsing does not handle any
> escaping of quotes, so that combination of both double and single quoted
> parts in a property value isn't possible.
>
> What you can do is construct the address options map manually (rather than
> relying on the string parsing), which works though it is admittedly clunky.
>
> See attached example.
>
>
That works perfectly, many thanks Gordon!



-- 

*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: Property names in subscription selectors

Posted by Gordon Sim <gs...@redhat.com>.
On 05/22/2015 12:38 PM, Chris Richardson wrote:
> No-go unfortunately:
>   Error: Unmatched '{'!, character 28 of my-queue;
> {link:{selector:""my-property"='property-value'"}}
>
> I've tried single quotes as well but that doesn't seem to help.

The selector syntax as recognised by the broker requires the property 
identifier to be enclosed in double quotes, but the value to be enclosed 
in single quotes.

However the qpid::messaging client's address parsing does not handle any 
escaping of quotes, so that combination of both double and single quoted 
parts in a property value isn't possible.

What you can do is construct the address options map manually (rather 
than relying on the string parsing), which works though it is admittedly 
clunky.

See attached example.

Re: Property names in subscription selectors

Posted by Chris Richardson <cr...@fourc.eu>.
No-go unfortunately:
 Error: Unmatched '{'!, character 28 of my-queue;
{link:{selector:""my-property"='property-value'"}}

I've tried single quotes as well but that doesn't seem to help.

On 22 May 2015 at 12:31, Robbie Gemmell <ro...@gmail.com> wrote:

> I haven't tried this but one trick I know is used elsewhere and might
> be worth a shot is to use [double] quotes around the property name as
> well, i.e pretending it is a literal like for the values.
>
> On 22 May 2015 at 12:13, Chris Richardson <cr...@fourc.eu> wrote:
> > Hi,
> >
> > I'm trying to use a selector based on the information in this post:
> >
> http://grokbase.com/p/qpid/users/136t684en1/message-selection-filtering-using-c-client-with-the-java-broker
> >
> > except I'm using the C++ broker (and client) 0.32.
> >
> > The selector seems to work with the following syntax:
> >  "my-queue; {link:{selector:\"myproperty='property-value'\"}}"
> >
> > but if I try to use a message property which contains a hyphen, it does
> > not. Eg.
> > "my-queue; {link:{selector:\"my-property='property-value'\"}}"
> > matches nothing, even though the property exists in the message complete
> > with a hyphen in the name.
> >
> > I guess this is a restriction imposed by the property name being required
> > to be a java identifier?
> >
> > Is there any way around this, or another method/syntax I could use to
> > filter messages by property value in my queue subscription?
> >
> > Any advice much appreciated.
> >
> > --
> >
> > *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>!*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>


-- 

*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: Property names in subscription selectors

Posted by Robbie Gemmell <ro...@gmail.com>.
I haven't tried this but one trick I know is used elsewhere and might
be worth a shot is to use [double] quotes around the property name as
well, i.e pretending it is a literal like for the values.

On 22 May 2015 at 12:13, Chris Richardson <cr...@fourc.eu> wrote:
> Hi,
>
> I'm trying to use a selector based on the information in this post:
> http://grokbase.com/p/qpid/users/136t684en1/message-selection-filtering-using-c-client-with-the-java-broker
>
> except I'm using the C++ broker (and client) 0.32.
>
> The selector seems to work with the following syntax:
>  "my-queue; {link:{selector:\"myproperty='property-value'\"}}"
>
> but if I try to use a message property which contains a hyphen, it does
> not. Eg.
> "my-queue; {link:{selector:\"my-property='property-value'\"}}"
> matches nothing, even though the property exists in the message complete
> with a hyphen in the name.
>
> I guess this is a restriction imposed by the property name being required
> to be a java identifier?
>
> Is there any way around this, or another method/syntax I could use to
> filter messages by property value in my queue subscription?
>
> Any advice much appreciated.
>
> --
>
> *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>!*

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