Quantcast

getBody(Class<T> type) on originalMessage returns null

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

getBody(Class<T> type) on originalMessage returns null

Tristan Hill
Hi,

https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Message.html#getBody(java.lang.Class)
gives the impression that
when called a conversion will be performed on the body.  When I use this
method on a getUnitOfWork().getOriginalInMessage() though it doesn't do
a conversion as there is no exchange set on the message.

Perhaps in the DefaultUnitOfWork constructor the exchange should be set
on originalInMessage for this to work?

Someone else experienced the same issue here -
http://camel.465427.n5.nabble.com/getOriginalMessage-td5748702.html#a5748723

Thanks
Tristan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getBody(Class<T> type) on originalMessage returns null

Claus Ibsen-2
What version of Camel do you use, and what kind of Camel component is
the message originally from

On Wed, Feb 15, 2017 at 3:22 PM, Tristan Hill <[hidden email]> wrote:

> Hi,
>
> https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Message.html#getBody(java.lang.Class)
> gives the impression that
> when called a conversion will be performed on the body.  When I use this
> method on a getUnitOfWork().getOriginalInMessage() though it doesn't do
> a conversion as there is no exchange set on the message.
>
> Perhaps in the DefaultUnitOfWork constructor the exchange should be set
> on originalInMessage for this to work?
>
> Someone else experienced the same issue here -
> http://camel.465427.n5.nabble.com/getOriginalMessage-td5748702.html#a5748723
>
> Thanks
> Tristan



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getBody(Class<T> type) on originalMessage returns null

Tristan Hill
On 2017-02-16 09:52, Claus Ibsen wrote:
> What version of Camel do you use, and what kind of Camel component is
> the message originally from
>

I'm using 2.18.2 with the File component.  The other user I referenced
mentions 2.12.1 also with the File component.

> On Wed, Feb 15, 2017 at 3:22 PM, Tristan Hill <[hidden email]>
> wrote:

>> Perhaps in the DefaultUnitOfWork constructor the exchange should be
>> set
>> on originalInMessage for this to work?
>>


Further on this, it appears message.setExchange is not on the Message
interface but a public method on MessageSupport.  Would it make sense to
have it on the interface as well so the object doesn't need to cast?

Thanks
Tristan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: getBody(Class<T> type) on originalMessage returns null

Claus Ibsen-2
On Thu, Feb 16, 2017 at 11:11 AM, Tristan Hill <[hidden email]> wrote:

> On 2017-02-16 09:52, Claus Ibsen wrote:
>>
>> What version of Camel do you use, and what kind of Camel component is
>> the message originally from
>>
>
> I'm using 2.18.2 with the File component.  The other user I referenced
> mentions 2.12.1 also with the File component.
>
>> On Wed, Feb 15, 2017 at 3:22 PM, Tristan Hill <[hidden email]>
>> wrote:
>
>
>>> Perhaps in the DefaultUnitOfWork constructor the exchange should be set
>>> on originalInMessage for this to work?
>>>
>

Can you log a JIRA.

The copy logic need a way to copy over the exchange reference as well.

>
> Further on this, it appears message.setExchange is not on the Message
> interface but a public method on MessageSupport.  Would it make sense to
> have it on the interface as well so the object doesn't need to cast?
>

No you should not change exchange on a message, so no setter.


> Thanks
> Tristan
>



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Loading...