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 2018/02/09 10:48:39 UTC

Re: Type of node with Proton library

Hi Daniel,

It looks to me like you've almost answered your own question, or perhaps
that I've misunderstood it... however I'll forge ahead regardless!

I have some code which does this here:
https://github.com/fourceu/fourc-qpid-manager/blob/master/include/fourc/fmf/BrokerAgentTemplate.h
See line 532, "sendMessage". If you look past the Boost details you'll see
that it passes the node type in the sender address exactly as you have
specified with spout.

There is a second way to provide address attributes by passing a nested
Variant::Map structure to the address. This has been useful to me when
using other address attributes such as a link selector. I don't have an
example of this I can readily share but the pseudo-code might look
something like:

qpid::messaging::Session session;     // = connection.createSession etc
qpid::messaging::Message message; // the message to be sent

qpid::messaging::types::Variant::Map node_type;
qpid::messaging::types::Variant::Map options;
node_type["type"] = "topic";
options["node"] = node_type;
options["assert"] = "always";              // I've found that this is
important or the node type specification may be ignored

qpid::messaging::Address address("amq.topic");
address.setOptions(options);

auto sender = session.createSender(address);
sender.send(message);

HTH
Chris


On 7 February 2018 at 12:37, Gavrila, Daniel <D....@selex-es-gmbh.com>
wrote:

> Hi ,
>
> I was reading this thread
>
> http://qpid.2158936.n2.nabble.com/Queue-and-exchange-with-
> the-same-name-td7579722.html
>
> and I would like to know how I can specify the type of node( queue or
> topic) in C++ Proton like here:
>
> spout 'amq.topic; {node: {type:topic}}'
>
> spout 'amq.topic; {node: {type:queue}}'
>
> Best regards,
> Daniel
>
> Selex ES GmbH
> Sitz der Gesellschaft / Registered Office: Neuss
> Registergericht / Register Court: Neuss HRB 17453
> Gesch?ftsf?hrer / Managing Director: Ulrich Nellen
>



-- 

*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: Type of node with Proton library

Posted by Daniel Gavrila <d....@icloud.com>.
Hi Chris,

Many thanks for your answer. 
I‘m still confusing about all this terminology in the Apache Qpid project.

For me the „Proton library“ is the library that lives under „proton“ namespace. As you very well remarked the answer was already in mine question but for the library 
that lives in the namespace“qpid::messaging“.

Beside this particular question it would be more interesting for me to know the relationship between these 2 libraries.Which one is better? There are recommendations to use one library for a new project?There are some use case scenarios that can be covered just by one library?

Best regards,
Daniel 



> On 9. Feb 2018, at 11:48, Chris Richardson <cr...@fourc.eu> wrote:
> 
> Hi Daniel,
> 
> It looks to me like you've almost answered your own question, or perhaps
> that I've misunderstood it... however I'll forge ahead regardless!
> 
> I have some code which does this here:
> https://github.com/fourceu/fourc-qpid-manager/blob/master/include/fourc/fmf/BrokerAgentTemplate.h
> See line 532, "sendMessage". If you look past the Boost details you'll see
> that it passes the node type in the sender address exactly as you have
> specified with spout.
> 
> There is a second way to provide address attributes by passing a nested
> Variant::Map structure to the address. This has been useful to me when
> using other address attributes such as a link selector. I don't have an
> example of this I can readily share but the pseudo-code might look
> something like:
> 
> qpid::messaging::Session session;     // = connection.createSession etc
> qpid::messaging::Message message; // the message to be sent
> 
> qpid::messaging::types::Variant::Map node_type;
> qpid::messaging::types::Variant::Map options;
> node_type["type"] = "topic";
> options["node"] = node_type;
> options["assert"] = "always";              // I've found that this is
> important or the node type specification may be ignored
> 
> qpid::messaging::Address address("amq.topic");
> address.setOptions(options);
> 
> auto sender = session.createSender(address);
> sender.send(message);
> 
> HTH
> Chris
> 
> 
> On 7 February 2018 at 12:37, Gavrila, Daniel <D....@selex-es-gmbh.com>
> wrote:
> 
>> Hi ,
>> 
>> I was reading this thread
>> 
>> http://qpid.2158936.n2.nabble.com/Queue-and-exchange-with-
>> the-same-name-td7579722.html
>> 
>> and I would like to know how I can specify the type of node( queue or
>> topic) in C++ Proton like here:
>> 
>> spout 'amq.topic; {node: {type:topic}}'
>> 
>> spout 'amq.topic; {node: {type:queue}}'
>> 
>> Best regards,
>> Daniel
>> 
>> Selex ES GmbH
>> Sitz der Gesellschaft / Registered Office: Neuss
>> Registergericht / Register Court: Neuss HRB 17453
>> Gesch?ftsf?hrer / Managing Director: Ulrich Nellen
>> 
> 
> 
> 
> -- 
> 
> *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