Hi,for properties of a message, the type of their value can only be boolean, 
byte, 
short, int, long, float, double, or String.You can not assign its value with 
byte array type.
You can call the setBytes method of the message like this:
message.setBytes("TEST-ByteArray", bytes);
The other simple approach to transfer byte array is to use BytesMessage instead 
of MapMessage.

At 2013-02-12 21:10:41,pwalter <[email protected]> wrote:
>Trying to add a byte[] as an item in an IMapMessage...
>
>IMapMessage message = producer.getSession().CreateMapMessage();
>
>string sval = "STRANGE BYTES FROM WORD DOC:
>üøôðôìèìäôìàìÜìÜìÜìÜàìàØàìÔÐÔÐÌÈÌÐ";
>byte[] bytes = Encoding.UTF8.GetBytes(sval);
>message.Properties.SetBytes("TEST-ByteArray", bytes);
>
>It fails on the SetBytes() method.  IS THERE A BETTER WAY TO SET BYTES IN A
>MAP MESSAGE??
>
>Thanks
>
>
>Errors and Failures:
>1) Test Error :
>ProducerSendConsumerReceive.TestFixture1.TestConsumerSupport_set MessageBody
>   Apache.NMS.MessageFormatException : Byte Arrays not allowed in this
>PrimitiveMap
>  ----> System.NotSupportedException : Byte Arrays not allowed in this
>PrimitiveMap
>   at Apache.NMS.Util.PrimitiveMapInterceptor.SetObjectProperty(String name,
>Object value) in
>c:\dev\NMS\src\main\csharp\Util\PrimitiveMapInterceptor.cs:line 95
>
>   at Apache.NMS.Util.MessagePropertyIntercepter.SetObjectProperty(String
>name, Object value) in
>c:\dev\NMS\src\main\csharp\Util\MessagePropertyIntercepter.cs:line 93
>   at Apache.NMS.Util.PrimitiveMapInterceptor.SetBytes(String key, Byte[]
>value, Int32 offset, Int32 length) in
>c:\dev\NMS\src\main\csharp\Util\PrimitiveMapInterceptor.cs:line 411
>   at Apache.NMS.Util.PrimitiveMapInterceptor.SetBytes(String key, Byte[]
>value)
> in c:\dev\NMS\src\main\csharp\Util\PrimitiveMapInterceptor.cs:line 404
>   at ProducerSendConsumerReceive.TestFixture1.addMessageData(IMessage
>message)
>in
>C:\work\dev\trunk\common\Project\FreeFlyerExtensions\TrajService\Test\FDSMessagingConsumerSupportTest\ConsumerSupportTest\TestFixture.cs:line
>105
>   at
>ProducerSendConsumerReceive.TestFixture1.TestConsumerSupport_setMessageBody()
>in C:\work\dev\trunk\common\Project\FreeFlyerExtensions\TrajService\Test\FDS
>Messaging\ConsumerSupportTest\ConsumerSupportTest\TestFixture.cs:line 29
>--NotSupportedException
>   at Apache.NMS.Util.PrimitiveMapInterceptor.SetObjectProperty(String name,
>Object value) in
>c:\dev\NMS\src\main\csharp\Util\PrimitiveMapInterceptor.cs:line 88
>
>
>
>
>
>
>
>
>
>--
>View this message in context: 
>http://activemq.2283324.n4.nabble.com/Byte-Arrays-In-IMapMessage-tp4663255.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to