You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Bill Whiting <te...@bellsouth.net> on 2009/08/11 20:09:40 UTC

Message.setData()

I'm trying to send a message with non-printable characters in the content.

I added the bytes to a string and then called setData() like this

         std::string messageData((char *)dataStruct, length);
         aMessage.setData(env.envMsg);

where dataStruct is the binary contentthat needs to be inserted into the 
message
and length is the number of bytes in the payload.

What I'm seeing is that aMessage.getData().length() is zero
but messageData.length().

what am I missing? shouldn't this work?

//Bill


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Message.setData()

Posted by Bill Whiting <te...@bellsouth.net>.
That was exactly the problem.
I'm adding AMQ support to code that already has functions for encoding 
data for byte-order, so that's not a problem.  When I pass the right 
variable into setData() I get the correct result.

Thanks,
//Bill

On 08/11/2009 02:26 PM, Ted Ross wrote:
> Bill,
>
> I'm not completely following your example.  What is "env.envMsg"?  If 
> you use "messageData" as the argument to .setData, then 
> .getData().length() should be the same as length.
>
> Please be advised that the contents of dataStruct will be copied 
> octet-for-octet into the message payload.  This message may not be 
> usable on the receiving system if that system's architecture or 
> endian-order are different.
>
> -Ted
>
> Bill Whiting wrote:
>> I'm trying to send a message with non-printable characters in the 
>> content.
>>
>> I added the bytes to a string and then called setData() like this
>>
>>         std::string messageData((char *)dataStruct, length);
>>         aMessage.setData(env.envMsg);
>>
>> where dataStruct is the binary contentthat needs to be inserted into 
>> the message
>> and length is the number of bytes in the payload.
>>
>> What I'm seeing is that aMessage.getData().length() is zero
>> but messageData.length().
>>
>> what am I missing? shouldn't this work?
>>
>> //Bill
>>
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Message.setData()

Posted by Ted Ross <tr...@redhat.com>.
Bill,

I'm not completely following your example.  What is "env.envMsg"?  If 
you use "messageData" as the argument to .setData, then 
.getData().length() should be the same as length.

Please be advised that the contents of dataStruct will be copied 
octet-for-octet into the message payload.  This message may not be 
usable on the receiving system if that system's architecture or 
endian-order are different.

-Ted

Bill Whiting wrote:
> I'm trying to send a message with non-printable characters in the 
> content.
>
> I added the bytes to a string and then called setData() like this
>
>         std::string messageData((char *)dataStruct, length);
>         aMessage.setData(env.envMsg);
>
> where dataStruct is the binary contentthat needs to be inserted into 
> the message
> and length is the number of bytes in the payload.
>
> What I'm seeing is that aMessage.getData().length() is zero
> but messageData.length().
>
> what am I missing? shouldn't this work?
>
> //Bill
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Message.setData()

Posted by Bill Whiting <te...@bellsouth.net>.
Nevermind,
It should have been
     aMessage.setData(messageData);
That works.

//Bill

On 08/11/2009 02:09 PM, Bill Whiting wrote:
> I'm trying to send a message with non-printable characters in the 
> content.
>
> I added the bytes to a string and then called setData() like this
>
>         std::string messageData((char *)dataStruct, length);
>         aMessage.setData(env.envMsg);
>
> where dataStruct is the binary contentthat needs to be inserted into 
> the message
> and length is the number of bytes in the payload.
>
> What I'm seeing is that aMessage.getData().length() is zero
> but messageData.length().
>
> what am I missing? shouldn't this work?
>
> //Bill
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org