Many thanks for your responses. Using the single quote helped me to get this 
working. 

Now I am trying to add a request to a queue. For this I create a sender and 
receiver where I would send the request on 'queue://ID.RequestQueueExample' and 
then receive any response from 'queue://ID.ResponseQueueExample'.
Sender sender = session.createSender("'queue://ID.RequestQueueExample'");
Receiver recv = session.createReceiver("'queue://ID.ResponseQueueExample'");

Then I create a Message and set the necessary parameters and prepare the 
Content as required.  The content needs to be in XML format which I populate 
beforehand, extract it in a string and then invoke Message::setContent(str).
I also tried setting the contentType to "utf8".  Not sure if we need to set 
this to any other type?
Here is an example of the string passed to Message::setContent(str) - 
<ExampleRequestMsg>
  <Header>
    <field1>ABCDE</field1>
    <field2>AB_CDE</field2>
  </Header>
  <Body>
    <field1>XYZ</field1>
  </Body>
</ExampleRequestMsg>

However, when I send the request, I receive back error from the broker in the 
receiver queue complaining that the message format is incorrect. My suspicion 
are -

1)  The content and contentType is not being set properly.
2)  I do not find the sender queue details in the outgoing AMQP frames.  In the 
message, I set the Message::ReplyTo with the Receiver Queue Address. After 
looking at some example AMPQ frames which seems to be taken from JMS, I see 
that the outgoing frame also has the Sender queue address 
'queue://ID.ReqQueueExample' in the outgoing frame. I am not quite sure how can 
I add that with the C++ QPID API. The Message class do not seem to have that 
option.

Any suggestions for the above 2 points would be highly appreciated.

Best Regards,
Rahul
-----Original Message-----
From: Robbie Gemmell <robbie.gemm...@gmail.com> 
Sent: 01 July 2021 15:01
To: users <users@qpid.apache.org>
Subject: Re: QPID C++ Subscribing to a topic

On Thu, 1 Jul 2021 at 13:18, Gordon Sim <g...@redhat.com> wrote:
>
> On Thu, Jul 1, 2021 at 1:08 PM rahul.sin...@morganstanley.com 
> <rahul.sin...@morganstanley.com> wrote:
> >   1.  As per Robbie's suggestion, I have tried adding topic:// in the past 
> > as well but the address and name selection gets chopped off from our end 
> > (after topic: ) in the outgoing AMQP frame to Broker.
> >
> > Our Code -
> > qpid::messaging::Receiver topic_receiver = 
> > session.createReceiver("topic://ID.ExampleTopic; {node:{type:topic}}"
> > ");
>
> You need some ugly quoting in there, netsed single quotes around the 
> address, e.g.:
>
>    session.createReceiver("'topic://ID.ExampleTopic'; 
> {node:{type:topic}}");
>
> That prevents the '/' being misinterpreted. (It has special meaning in 
> the qpid::messaging address syntax, which we don't want here).
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For 
> additional commands, e-mail: users-h...@qpid.apache.org
>

What Gordon said with the quoting should work to get it to parse correctly, I 
forgot about that being needed (as its not a combination I've really used 
myself).

Note I wasnt suggesting you do both the prefix and the 'type:topic'
node config though, as I dont think ActiveMQ 5 actually looks for the terminus 
'topic' capability that adds, rather it uses the address name and looks for a 
name prefix of "topic://" (something which e.g the JMS client adds itself under 
the covers based on values the broker advertises at connection open time).

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


--------------------------------------------------------------------------------
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or 
views contained herein are not intended to be, and do not constitute, advice 
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and 
Consumer Protection Act. If you have received this communication in error, 
please destroy all electronic and paper copies and notify the sender 
immediately. Mistransmission is not intended to waive confidentiality or 
privilege. Morgan Stanley reserves the right, to the extent permitted under 
applicable law, to monitor electronic communications. This message is subject 
to terms available at the following link: 
http://www.morganstanley.com/disclaimers  If you cannot access these links, 
please notify us by reply message and we will send the contents to you. By 
communicating with Morgan Stanley you consent to the foregoing and to the voice 
recording of conversations with personnel of Morgan Stanley.

You may have certain rights regarding the information that Morgan Stanley 
collects about you.  Please see our Privacy Pledge 
https://www.morganstanley.com/privacy-pledge for more information about your 
rights.

Reply via email to