ActiveMQ-CPP MessageNotReadableException

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveMQ-CPP MessageNotReadableException

spamtrap
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?

Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ-CPP MessageNotReadableException

tabish121@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.
[hidden email] | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ-CPP MessageNotReadableException

spamtrap
On Thu, 15 May 2014 09:41:04 -0400, Timothy Bish
<[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ-CPP MessageNotReadableException

tabish121@gmail.com
On 05/22/2014 06:03 AM, spam trap wrote:

> On Thu, 15 May 2014 09:41:04 -0400, Timothy Bish
> <[hidden email]> 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.
[hidden email] | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/