Camel has support for message transformation using several techniques. One such technique is Data Formats, where marshal and unmarshal comes from.
Marshal - Transforms the message body (such as Java object) into a binary or textual format, ready to be wired over the network.
Unmarshal - Transforms data in some binary or textual format (such as received over the network) into a Java object; or some other representation according to the data format being used.
Then the reverse operation happens to transform the Java objects back into XML also via JAXB, but using the
marshal operation. And finally the message is routed to a JMS queue.
from("file:inbox/xml") .unmarshal().jaxb() .to("bean:validateOrder") .marshal().jaxb() .to("jms:queue:order");
And in XML:
<route> <from uri="file:inbox/xml"/> <unmarshal><jaxb/></unmarshal> <to uri="bean:validateOrder"/> <marshal><jaxb/></marshal> <to uri="jms:queue:order"/> </route>