It’s hard for the Camel to know if the null body is intend of just a lazy value.
I think you can work around it by setting the message body to be an empty 
String instead of null if you don’t want to Camel to process the message any 
more.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 1, 2015 at 5:02:58 PM, A.Light (angelo.leg...@axiossystems.com) wrote:
> Hi all,
> using the file component I encountered a behaviour that doesn't seem right
> to me... but maybe it's an intended behaviour.
>  
> Basically the issue shows when I have a route that reads the contents of a
> file using the file component and then the message body goes to null. At
> this point, any subsequent call to "getBody" (for instance a log("${body})
> will cause the file to be read again, and put in the body.
>  
> This behaviour is caused by the GenericFileMessage method "createBody()"
> (invoked by the MessageSupport.getBody() when the body is null) that, for
> the sake of lazy file loading, loads the file again every time it is
> invoked.
>  
> This means that I cannot have an empty body, for any reason, in a route
> initiated by a file component. This seems wrong to me as null body can have
> valid meaning in a camel route.
> It this an intended behaviour?
>  
> I created a test class for this issue that you can get here:
> TestGhostFileBody.java
>  
> .
> Let me know if you have problems getting it.
>  
> Thanks,
> A.
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/GenericFileMessage-creates-body-from-file-multiples-times-tp5765116.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  

Reply via email to