...
Camel supports a pluggable DataFormat to allow messages to be marshalled to and from binary or text formats to support a kind of Message Translator.
The following data formats are currently supported
...
:
Include Page | ||||
---|---|---|---|---|
|
And related is the following:
- DataFormat Component for working with Data Formats as if it was a regular Component supporting Endpoints and URIs.
- Dozer Type Conversion using Dozer for type converting POJOs
Unmarshalling
If you receive a message from one of the Camel Components such as File, HTTP or JMS you often want to unmarshal the payload into some bean so that you can process it using some Bean Integration or perform Predicate evaluation and so forth. To do this use the unmarshal word in the DSL in Java or the Xml Configuration.
...
Code Block |
---|
from("file://foo/bar").
unmarshal().serialization().
marshal("jaxb").
to("activemq:Some.Queue");
|
Using Spring XML
This example shows how to configure the data type just once and reuse it on multiple routes
Wiki Markup |
---|
{snippet:id=example|lang=xml|url=camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/marshalAndUnmarshalWithRef.xml} |
You can also define reusable data formats as Spring beans
Code Block |
---|
<bean id="myJaxb" class="org.apache.camel.model.dataformat.JaxbDataFormat">
<property name="prettyPrint" value="true"/>
<property name="contextPath" value="org.apache.camel.example"/>
</bean>
|