You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by spam trap <no...@spamgourmet.com> on 2014/05/07 11:22:30 UTC

ActiveMQ-CPP MessageNotReadableException

I need to display the complete message sent from an application in
debugging mode.  However I get the MessageNotReadableException thrown
when trying to access the body.  Is there a way of making the message
readable or otherwise displaying the body?


Re: ActiveMQ-CPP MessageNotReadableException

Posted by Timothy Bish <ta...@gmail.com>.
On 05/22/2014 06:03 AM, spam trap wrote:
> On Thu, 15 May 2014 09:41:04 -0400, Timothy Bish
> <ta...@gmail.com> wrote:
>
>> On 05/07/2014 05:22 AM, spam trap wrote:
>>> I need to display the complete message sent from an application in
>>> debugging mode.  However I get the MessageNotReadableException thrown
>>> when trying to access the body.  Is there a way of making the message
>>> readable or otherwise displaying the body?
>>>
>>>
>> Can you provide a bit more detail on what you are doing here, I'm not
>> entirely clear on it.  There are some tricks that you could do if you
>> cast the Message object into the internal ActiveMQMessage types but
>> without seeing some code its hard to help you with an exact solution.
> My original post seemed to take ages to show on my newsserver so I
> missed your reply until today.
>
> I am trying to print out (in hex) the content of a BytesMessage body
> before it is sent to a queue (for debugging purposes).  Trying to get
> the body length or data lead to the MessageNotReadableException being
> thrown.
>
> For now I have solved it by using
> activemq::commands::Message::setReadOnlyBody(true)
>
> However I see that there is also cms::Message::reset().
>
> I wonder if either or both are suitable.
>
>
Yes, for the BytesMessage the reset method should be all you need.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: ActiveMQ-CPP MessageNotReadableException

Posted by spam trap <no...@spamgourmet.com>.
On Thu, 15 May 2014 09:41:04 -0400, Timothy Bish
<ta...@gmail.com> wrote:

>On 05/07/2014 05:22 AM, spam trap wrote:
>> I need to display the complete message sent from an application in
>> debugging mode.  However I get the MessageNotReadableException thrown
>> when trying to access the body.  Is there a way of making the message
>> readable or otherwise displaying the body?
>>
>>
>Can you provide a bit more detail on what you are doing here, I'm not 
>entirely clear on it.  There are some tricks that you could do if you 
>cast the Message object into the internal ActiveMQMessage types but 
>without seeing some code its hard to help you with an exact solution.

My original post seemed to take ages to show on my newsserver so I
missed your reply until today.

I am trying to print out (in hex) the content of a BytesMessage body
before it is sent to a queue (for debugging purposes).  Trying to get
the body length or data lead to the MessageNotReadableException being
thrown.

For now I have solved it by using
activemq::commands::Message::setReadOnlyBody(true)

However I see that there is also cms::Message::reset().

I wonder if either or both are suitable.


Re: ActiveMQ-CPP MessageNotReadableException

Posted by Timothy Bish <ta...@gmail.com>.
On 05/07/2014 05:22 AM, spam trap wrote:
> I need to display the complete message sent from an application in
> debugging mode.  However I get the MessageNotReadableException thrown
> when trying to access the body.  Is there a way of making the message
> readable or otherwise displaying the body?
>
>
Can you provide a bit more detail on what you are doing here, I'm not 
entirely clear on it.  There are some tricks that you could do if you 
cast the Message object into the internal ActiveMQMessage types but 
without seeing some code its hard to help you with an exact solution.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/