You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Robbie Gemmell <ro...@gmail.com> on 2015/07/21 18:14:05 UTC

change hello_world.cpp example to use setContentObject ?

The hello_world.cpp example for Qpid Messaging C++ currently sends its
message by doing "sender.send(Message("Hello world!"));" which causes
it to send a data body section containing the bytes, when using AMQP
1.0.

Aleternatively, doing this:

    Message msg;
    msg.setContentObject("Hello World!");
    msg.getContentObject().setEncoding("utf8");
    sender.send(msg);

results in the payload sent by the client changing to an amqp-value
body section containing a utf8 string.

The other examples appear to use setContentObject already when sending
strings. Is there any reaosn not to do the same for the simple hello
world example?

Robbie

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


Re: change hello_world.cpp example to use setContentObject ?

Posted by Chuck Rolke <cr...@redhat.com>.
I'll apply the same to the .NET Binding example.

----- Original Message -----
> From: "Gordon Sim" <gs...@redhat.com>
> To: users@qpid.apache.org
> Sent: Monday, July 27, 2015 7:15:44 AM
> Subject: Re: change hello_world.cpp example to use setContentObject ?
> 
> On 07/21/2015 05:14 PM, Robbie Gemmell wrote:
> > The hello_world.cpp example for Qpid Messaging C++ currently sends its
> > message by doing "sender.send(Message("Hello world!"));" which causes
> > it to send a data body section containing the bytes, when using AMQP
> > 1.0.
> >
> > Aleternatively, doing this:
> >
> >      Message msg;
> >      msg.setContentObject("Hello World!");
> >      msg.getContentObject().setEncoding("utf8");
> >      sender.send(msg);
> >
> > results in the payload sent by the client changing to an amqp-value
> > body section containing a utf8 string.
> >
> > The other examples appear to use setContentObject already when sending
> > strings. Is there any reaosn not to do the same for the simple hello
> > world example?
> 
> That would be a sensible change.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
> 
> 

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


Re: change hello_world.cpp example to use setContentObject ?

Posted by Robbie Gemmell <ro...@gmail.com>.
On 27 July 2015 at 12:15, Gordon Sim <gs...@redhat.com> wrote:
> On 07/21/2015 05:14 PM, Robbie Gemmell wrote:
>>
>> The hello_world.cpp example for Qpid Messaging C++ currently sends its
>> message by doing "sender.send(Message("Hello world!"));" which causes
>> it to send a data body section containing the bytes, when using AMQP
>> 1.0.
>>
>> Aleternatively, doing this:
>>
>>      Message msg;
>>      msg.setContentObject("Hello World!");
>>      msg.getContentObject().setEncoding("utf8");
>>      sender.send(msg);
>>
>> results in the payload sent by the client changing to an amqp-value
>> body section containing a utf8 string.
>>
>> The other examples appear to use setContentObject already when sending
>> strings. Is there any reaosn not to do the same for the simple hello
>> world example?
>
>
> That would be a sensible change.
>
>

I went to commit the change but see you already did, thanks :)

https://issues.apache.org/jira/browse/QPID-6665

Robbie

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


Re: change hello_world.cpp example to use setContentObject ?

Posted by Gordon Sim <gs...@redhat.com>.
On 07/21/2015 05:14 PM, Robbie Gemmell wrote:
> The hello_world.cpp example for Qpid Messaging C++ currently sends its
> message by doing "sender.send(Message("Hello world!"));" which causes
> it to send a data body section containing the bytes, when using AMQP
> 1.0.
>
> Aleternatively, doing this:
>
>      Message msg;
>      msg.setContentObject("Hello World!");
>      msg.getContentObject().setEncoding("utf8");
>      sender.send(msg);
>
> results in the payload sent by the client changing to an amqp-value
> body section containing a utf8 string.
>
> The other examples appear to use setContentObject already when sending
> strings. Is there any reaosn not to do the same for the simple hello
> world example?

That would be a sensible change.


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