Available as of Camel 2.1
As usually you can use either Java DSL or Spring XML to work with Castor Data Format.
Using the Java DSL
For example the following uses a named DataFormat of Castor which uses default Castor data binding features.
If you prefer to use a named reference to a data format which can then be defined in your Registry such as via your Spring XML file. e.g.
If you want to override default mapping schema by providing a mapping file you can set it as follows.
Also if you want to have more control on Castor Marshaller and Unmarshaller you can access them as below.
Using Spring XML
The following example shows how to use Castor to unmarshal using Spring configuring the castor data type
This example shows how to configure the data type just once and reuse it on multiple routes. You have to set the <castor> element directly in <camelContext>.
Castor supports the following options
To use Castor in your camel routes you need to add the a dependency on camel-castor which implements this data format.
If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see the download page for the latest versions).