Marshal EIP
Marshalling is the opposite of unmarshalling, where a bean is marshalled into some binary or textual format for transmission over some transport via a Camel Components. Marshalling is used in the same way as unmarshalling above; in the DSL you can use a DataFormat instance, you can configure the DataFormat dynamically using the DSL or you can refer to a named instance of the format in the Registry.
Options
The Marshal EIP supports 1 options which are listed below:
Name | Description | Default | Type |
---|---|---|---|
dataFormatType |
Required The data format to be used |
DataFormatDefinition |
Samples
The following example unmarshals via serialization then marshals using a named JAXB data format to perform a kind of Message Translator.
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
You can also define reusable data formats as Spring beans
<bean id="myJaxb" class="org.apache.camel.model.dataformat.JaxbDataFormat">
<property name="prettyPrint" value="true"/>
<property name="contextPath" value="org.apache.camel.example"/>
</bean>