camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A.Light" <angelo.leg...@axiossystems.com>
Subject GenericFileMessage creates body from file multiples times
Date Wed, 01 Apr 2015 09:01:39 GMT
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
<http://camel.465427.n5.nabble.com/file/n5765116/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.

Mime
View raw message