...
XStream is a Data Format which uses the XStream library to marshal and unmarshal Java objects to and from XML.
To use XStream in your camel routes you need to add the a dependency on camel-xstream which implements this data format.
Maven users will need to add the following dependency to their pom.xml
for this component:
Codeblock |
|
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xstream</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
|
Codeblock |
// lets turn Object messages into XML then send to MQSeries
from("activemq:My.Queue").
marshal().xstream().
to("mqseries:Another.Queue");
|
...
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.
Codeblock |
from("activemq:My.Queue").
marshal().xstream("UTF-8").
to("mqseries:Another.Queue");
|
Wiki-Markup |
{snippet:id=e1|lang=xml|url=""> |
Dependencies
To 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).
Codeblock |
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xstream</artifactId>
<version>x.x.x</version>
</dependency>
|