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 2017/08/26 11:08:24 UTC

Address options grammar

Hi,

Using the qpid-cpp-1.36 broker/client I am trying to specify two clauses on
a receiver node (queue) address; one is a selector and looks something like
this:

Variant::Map options;
Variant::Map selector;
selector["selector"] = "<some selector string>";
options["link"] = selector;

the other is a node type specification and looks like

Variant::Map node_type;
node_type["type"] = "queue";
options["node"] = node_type; // using "options" from previous example
options["assert"] = "always";

Either one of these works on their own, but when combined the second clause
seems to be ignored and an attempt to access the queue name as an exchange
is made, which gets denied by the ACL.

Am I doing something nonsensical like trying to combine
AMQP-0.10/AMQP-1.0/JMS grammar? Ref:
https://qpid.apache.org/releases/qpid-cpp-1.36.0/messaging-api/book/section-addresses.html,
it appears that the "selector" keyword does not exist at all - my use of
this is based on this previous question
http://qpid.2158936.n2.nabble.com/Property-names-in-subscription-selectors-td7625162.html#a7625166
(and nested links).

Some clarification would be much appreciated!

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: Address options grammar

Posted by Jakub Scholz <ja...@scholz.cz>.
Yeah, you are right. If you use the constructor the type from options is
ignored. Looking at the code it seems this is because the constructor first
uses the options and afterwards overwrites the type with the empty string
passed as a type (see
https://github.com/apache/qpid-cpp/blob/49e3afbc62f6fbb361e830b1e4baa77a046ac718/src/qpid/messaging/Address.cpp#L45-L47).
So if yo want to use the constructor you can do so, but don't specify the
type in the options but use the type field for it instead. That seems to
work fine.

I think this can be easily fixed by creating second constructor without the
type.

Jakub

On Sat, Aug 26, 2017 at 10:02 PM, Chris Richardson <cr...@fourc.eu> wrote:

> I was using the Address constructor
>
> Address(const std::string& name, const std::string& subject,
>                                const qpid::types::Variant::Map& options,
> const std::string& type = "");
>
> to provide the name and options. It seems the behaviour is not the same
> though as your method also works for me. Problem solved, thanks very much
> :)
>
> C
>
> On 26 August 2017 at 14:30, Jakub Scholz <ja...@scholz.cz> wrote:
>
> > How exactly do you create the address and what do you have in you client
> /
> > broker log?
> >
> > When I try to do something like this:
> >     Address myAddress;
> >     Variant::Map options;
> >     Variant::Map selector;
> >     selector["selector"] = "color='blue'";
> >     options["link"] = selector;
> >     Variant::Map node_type;
> >     node_type["type"] = "queue";
> >     options["node"] = node_type;
> >     options["assert"] = "always";
> >     myAddress.setOptions(options);
> >     myAddress.setName("myTest");
> >
> > For me it seems to work properly. The client log correctly creates the
> > address:
> >     2017-08-26 13:28:14 [Client] debug treating source address as queue:
> > myTest;{assert:always, link:{selector:color='blue'}, node:{type:queue}}
> > The client sends only QueueDeclare and QueueQuery and the only ACL right
> > needed seem to be queue/access and queue/consume.
> >
> > Regards
> > Jakub
> >
> > On Sat, Aug 26, 2017 at 1:08 PM, Chris Richardson <cr...@fourc.eu> wrote:
> >
> > > Hi,
> > >
> > > Using the qpid-cpp-1.36 broker/client I am trying to specify two
> clauses
> > on
> > > a receiver node (queue) address; one is a selector and looks something
> > like
> > > this:
> > >
> > > Variant::Map options;
> > > Variant::Map selector;
> > > selector["selector"] = "<some selector string>";
> > > options["link"] = selector;
> > >
> > > the other is a node type specification and looks like
> > >
> > > Variant::Map node_type;
> > > node_type["type"] = "queue";
> > > options["node"] = node_type; // using "options" from previous example
> > > options["assert"] = "always";
> > >
> > > Either one of these works on their own, but when combined the second
> > clause
> > > seems to be ignored and an attempt to access the queue name as an
> > exchange
> > > is made, which gets denied by the ACL.
> > >
> > > Am I doing something nonsensical like trying to combine
> > > AMQP-0.10/AMQP-1.0/JMS grammar? Ref:
> > > https://qpid.apache.org/releases/qpid-cpp-1.36.0/
> > > messaging-api/book/section-addresses.html,
> > > it appears that the "selector" keyword does not exist at all - my use
> of
> > > this is based on this previous question
> > > http://qpid.2158936.n2.nabble.com/Property-names-in-
> > > subscription-selectors-td7625162.html#a7625166
> > > (and nested links).
> > >
> > > Some clarification would be much appreciated!
> > >
> > > 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>!*
> > >
> >
>
>
>
> --
>
> *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: Address options grammar

Posted by Chris Richardson <cr...@fourc.eu>.
I was using the Address constructor

Address(const std::string& name, const std::string& subject,
                               const qpid::types::Variant::Map& options,
const std::string& type = "");

to provide the name and options. It seems the behaviour is not the same
though as your method also works for me. Problem solved, thanks very much :)

C

On 26 August 2017 at 14:30, Jakub Scholz <ja...@scholz.cz> wrote:

> How exactly do you create the address and what do you have in you client /
> broker log?
>
> When I try to do something like this:
>     Address myAddress;
>     Variant::Map options;
>     Variant::Map selector;
>     selector["selector"] = "color='blue'";
>     options["link"] = selector;
>     Variant::Map node_type;
>     node_type["type"] = "queue";
>     options["node"] = node_type;
>     options["assert"] = "always";
>     myAddress.setOptions(options);
>     myAddress.setName("myTest");
>
> For me it seems to work properly. The client log correctly creates the
> address:
>     2017-08-26 13:28:14 [Client] debug treating source address as queue:
> myTest;{assert:always, link:{selector:color='blue'}, node:{type:queue}}
> The client sends only QueueDeclare and QueueQuery and the only ACL right
> needed seem to be queue/access and queue/consume.
>
> Regards
> Jakub
>
> On Sat, Aug 26, 2017 at 1:08 PM, Chris Richardson <cr...@fourc.eu> wrote:
>
> > Hi,
> >
> > Using the qpid-cpp-1.36 broker/client I am trying to specify two clauses
> on
> > a receiver node (queue) address; one is a selector and looks something
> like
> > this:
> >
> > Variant::Map options;
> > Variant::Map selector;
> > selector["selector"] = "<some selector string>";
> > options["link"] = selector;
> >
> > the other is a node type specification and looks like
> >
> > Variant::Map node_type;
> > node_type["type"] = "queue";
> > options["node"] = node_type; // using "options" from previous example
> > options["assert"] = "always";
> >
> > Either one of these works on their own, but when combined the second
> clause
> > seems to be ignored and an attempt to access the queue name as an
> exchange
> > is made, which gets denied by the ACL.
> >
> > Am I doing something nonsensical like trying to combine
> > AMQP-0.10/AMQP-1.0/JMS grammar? Ref:
> > https://qpid.apache.org/releases/qpid-cpp-1.36.0/
> > messaging-api/book/section-addresses.html,
> > it appears that the "selector" keyword does not exist at all - my use of
> > this is based on this previous question
> > http://qpid.2158936.n2.nabble.com/Property-names-in-
> > subscription-selectors-td7625162.html#a7625166
> > (and nested links).
> >
> > Some clarification would be much appreciated!
> >
> > 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>!*
> >
>



-- 

*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: Address options grammar

Posted by Jakub Scholz <ja...@scholz.cz>.
How exactly do you create the address and what do you have in you client /
broker log?

When I try to do something like this:
    Address myAddress;
    Variant::Map options;
    Variant::Map selector;
    selector["selector"] = "color='blue'";
    options["link"] = selector;
    Variant::Map node_type;
    node_type["type"] = "queue";
    options["node"] = node_type;
    options["assert"] = "always";
    myAddress.setOptions(options);
    myAddress.setName("myTest");

For me it seems to work properly. The client log correctly creates the
address:
    2017-08-26 13:28:14 [Client] debug treating source address as queue:
myTest;{assert:always, link:{selector:color='blue'}, node:{type:queue}}
The client sends only QueueDeclare and QueueQuery and the only ACL right
needed seem to be queue/access and queue/consume.

Regards
Jakub

On Sat, Aug 26, 2017 at 1:08 PM, Chris Richardson <cr...@fourc.eu> wrote:

> Hi,
>
> Using the qpid-cpp-1.36 broker/client I am trying to specify two clauses on
> a receiver node (queue) address; one is a selector and looks something like
> this:
>
> Variant::Map options;
> Variant::Map selector;
> selector["selector"] = "<some selector string>";
> options["link"] = selector;
>
> the other is a node type specification and looks like
>
> Variant::Map node_type;
> node_type["type"] = "queue";
> options["node"] = node_type; // using "options" from previous example
> options["assert"] = "always";
>
> Either one of these works on their own, but when combined the second clause
> seems to be ignored and an attempt to access the queue name as an exchange
> is made, which gets denied by the ACL.
>
> Am I doing something nonsensical like trying to combine
> AMQP-0.10/AMQP-1.0/JMS grammar? Ref:
> https://qpid.apache.org/releases/qpid-cpp-1.36.0/
> messaging-api/book/section-addresses.html,
> it appears that the "selector" keyword does not exist at all - my use of
> this is based on this previous question
> http://qpid.2158936.n2.nabble.com/Property-names-in-
> subscription-selectors-td7625162.html#a7625166
> (and nested links).
>
> Some clarification would be much appreciated!
>
> 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>!*
>