You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by "Hamid.Shahid" <ha...@sungard.com> on 2015/01/08 13:58:50 UTC
QPid 0.28 amqp1.0 Java vs C++ client
Hi,
I have the following java jms code which sends a string message with with
some properties to a broker and this works fine.
/TextMessage message = session.createTextMessage(msgString);
String correlationId = "abc1";
message.setJMSCorrelationID(correlationId);
message.setObjectProperty("MessageType", msgType);
message.setObjectProperty("AppID", appID);
message.setJMSReplyTo(consumerDestination);
producer.send(message);
/
I want to know, what will be the 'correct' equivalent of this in *Qpid 0.28
C++ client using amqp 1.0*.
How can I create a /qpid::messaging::Message/ from /msgString /of type
/std::string/ and set properties on the message.
Should it be correct to use /message.setContentObject(msgString)/ and the
setting /message.setProperties("MessageType", msgType)/? Or is there any
other way?
-----
Best Regards,
Hamid.
--
View this message in context: http://qpid.2158936.n2.nabble.com/QPid-0-28-amqp1-0-Java-vs-C-client-tp7618131.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: QPid 0.28 amqp1.0 Java vs C++ client
Posted by "Hamid.Shahid" <ha...@sungard.com>.
Thank you for explaining this difference.
-----
Best Regards,
Hamid.
--
View this message in context: http://qpid.2158936.n2.nabble.com/QPid-0-28-amqp1-0-Java-vs-C-client-tp7618131p7618150.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: QPid 0.28 amqp1.0 Java vs C++ client
Posted by Gordon Sim <gs...@redhat.com>.
On 01/08/2015 03:06 PM, Gordon Sim wrote:
> On 01/08/2015 02:56 PM, Hamid.Shahid wrote:
>> Thanks Gordon,
>>
>> But is it better to use /message.setContent(msgString)/ or to use
>> /message.setContentObject(msgString)/?
>
> Use Message::setContentObject(). If you use setContent() the data will
> be sent as a sequence of bytes rather than a utf8 string.
>
> (In AMQP 0-10, content was always bytes, and you indicated the way those
> bytes should be interpreted using a MIME type in setContentType(). In
> AMQP 1.0, this approach is still possible, but the recommended approach
> I believe is to use the AMQP typesystem to encode the content, which is
> why the setContentObject() method was needed).
One clarification here: to send as utf8 you currently also need to set
the encoding of the content object. E.g.
Message m;
m.setContentObject("abc");
m.getContentObject().setEncoding("utf8");
I'd like to eliminate the need for that, but at present it is still
required.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: QPid 0.28 amqp1.0 Java vs C++ client
Posted by Gordon Sim <gs...@redhat.com>.
On 01/08/2015 02:56 PM, Hamid.Shahid wrote:
> Thanks Gordon,
>
> But is it better to use /message.setContent(msgString)/ or to use
> /message.setContentObject(msgString)/?
Use Message::setContentObject(). If you use setContent() the data will
be sent as a sequence of bytes rather than a utf8 string.
(In AMQP 0-10, content was always bytes, and you indicated the way those
bytes should be interpreted using a MIME type in setContentType(). In
AMQP 1.0, this approach is still possible, but the recommended approach
I believe is to use the AMQP typesystem to encode the content, which is
why the setContentObject() method was needed).
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: QPid 0.28 amqp1.0 Java vs C++ client
Posted by "Hamid.Shahid" <ha...@sungard.com>.
Thanks Gordon,
But is it better to use /message.setContent(msgString)/ or to use
/message.setContentObject(msgString)/?
-----
Best Regards,
Hamid.
--
View this message in context: http://qpid.2158936.n2.nabble.com/QPid-0-28-amqp1-0-Java-vs-C-client-tp7618131p7618141.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: QPid 0.28 amqp1.0 Java vs C++ client
Posted by Gordon Sim <gs...@redhat.com>.
On 01/08/2015 12:58 PM, Hamid.Shahid wrote:
> Hi,
>
> I have the following java jms code which sends a string message with with
> some properties to a broker and this works fine.
>
> /TextMessage message = session.createTextMessage(msgString);
> String correlationId = "abc1";
> message.setJMSCorrelationID(correlationId);
> message.setObjectProperty("MessageType", msgType);
> message.setObjectProperty("AppID", appID);
> message.setJMSReplyTo(consumerDestination);
> producer.send(message);
> /
>
> I want to know, what will be the 'correct' equivalent of this in *Qpid 0.28
> C++ client using amqp 1.0*.
> How can I create a /qpid::messaging::Message/ from /msgString /of type
> /std::string/ and set properties on the message.
>
> Should it be correct to use /message.setContentObject(msgString)/ and the
> setting /message.setProperties("MessageType", msgType)/?
Yes, those are the correct methods.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org