camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Is there a WIKI page describing class type returned by getBody() method ?
Date Mon, 14 Apr 2008 15:40:27 GMT
On 14/04/2008, cmoulliard <cmoulliard@gmail.com> wrote:
>
>  Hi,
>
>  I would like to know if there a WIKI page describing the class type returned
>  by getBody() method of the class Exchange according to the component used ?
>
>  In the javadoc of Camel, it is mentioned that the method getBody() returns
>  an object. This object corresponds to a class of type java.io.File in the
>  case we use the File component (from("file:///c:/temp/test?delete=true"))

Great idea. We should raise a JIRA to track this; it would be handy
information to know.

We should make it easy to diagnose what the body type is; maybe we
should hack the log endpoint to make it easy to log the body content
and type?
http://activemq.apache.org/camel/log.html

>  It should be nice to have a table representing such information component by
>  component and WHICH class we can use to convert the body
>
>  ex :
>  - convertBodyTo(String.class) when parsing a file using from("file:///)
>  - convertBodyTo(DOMSource.class) when extracting message coming from a JBI
>  endpoint

BTW you only need to convert the body if you wanna process it in some
way. e.g. you can just get the body, when using the File component as
a File if you want. Or as a Source if you are using JBI. You only need
to convert to another type if its not the thing you want. e.g. you
could convert a JBI message body to a String if you fancied it etc.


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message