XStreamXStream is a Data Format which uses the XStream library to marshal and unmarshal Java objects to and from XML. // lets turn Object messages into XML then send to MQSeries from("activemq:My.Queue"). marshal().xstream(). to("mqseries:Another.Queue"); XMLInputFactory and XMLOutputFactoryThe XStream library uses the javax.xml.stream.XMLInputFactory and javax.xml.stream.XMLOutputFactory, you can control which implementation of this factory should be used. The Factory is discovered using this algorithm: How to set the XML encoding in Xstream DataFormat?From Camel 2.2.0, you can set the encoding of XML in Xstream DataFormat by setting the Exchange's property with the key Exchange.CHARSET_NAME, or setting the encoding property on Xstream from DSL or Spring config. from("activemq:My.Queue"). marshal().xstream("UTF-8"). to("mqseries:Another.Queue"); <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <!-- we define the json xstream data formats to be used (xstream is default) --> <dataFormats> <xstream id="xstream-utf8" encoding="UTF-8"/> <xstream id="xstream-default"/> </dataFormats> <route> <from uri="direct:in"/> <marshal ref="xstream-default"/> <to uri="mock:result"/> </route> <route> <from uri="direct:in-UTF-8"/> <marshal ref="xstream-utf8"/> <to uri="mock:result"/> </route> </camelContext> DependenciesTo use XStream in your camel routes you need to add the a dependency on camel-xstream 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-xstream</artifactId> <version>x.x.x</version> </dependency> |