Castor
Available as of Camel 2.1
Castor is a Data Format which uses the Castor XML library to unmarshal an XML payload into Java objects or to marshal Java objects into an XML payload.
from("direct:order"). marshal().castor(). to("activemq:queue:order");
Options
Castor supports the following options
Option |
Type |
Default |
Description |
---|---|---|---|
encoding |
String |
UTF-8 |
Encoding to use when marshalling an Object to XML |
validation |
Boolean |
false |
Whether validation is turned on or off. |
mappingFile |
String |
null |
Path to a Castor mapping file to load from the classpath. |
packages |
String[] |
null |
Add additional packages to Castor XmlContext |
classNames |
String[] |
null |
Add additional class names to Castor XmlContext |
Dependencies
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).
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-castor</artifactId> <version>2.1.0</version> </dependency>