I think if you turn on TRACE logging on the class
org.apache.camel.impl.converter.BaseTypeConverterRegistry,
you should see the type converter logic in action.

I also saw in a Camel core unit test, code along the lines of:

                from("file://target/gf")
                    .convertBodyTo(File.class)
                    .to("mock:result");
...then

mock.message(0).body().isInstanceOf(File.class);
...which means it expects it to be still of type File at the other end.

I don't know how you're sending the File object (ProducerTemplate or replacing In Message) if you are not using a ProducerTemplate, you could try the 2-arg version of setBody(...), i.e.:

exchange.getIn().setBody(body, File.class);

or just try explicit conversions via the DSL:

 .convertBodyTo(File.class)


   -Chris

On 10/8/2013 1:19 PM, Tom Ellis wrote:
Hi,

Is there some documentation around the strategy Camel takes when deciding
what to convert the body of an exchange to before sending to an endpoint?

For example, I have set a File object in the body of an exchange and send
this to a JMS endpoint. When the exchange is obtained from that endpoint,
the body contains a byte array of the contents of the file the File object
represents.

Given the File object is serializable I expected a File object to be
available at the other end. I could just send the File URI string and
create a new File object on the other side, but I wondered where/if the
conversion strategy for Camel is documented?

Cheers,

Tom

Reply via email to