You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

JiBX

JiBX is a Data Format which uses the JiBX 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().jibx().
  to("mqseries:Another.Queue");
{code:xml}

h3. JiBX Spring DSL

JiBX data format is also supported by Camel Spring DSL.

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

<dataFormats>
<jibx id="jibx" unmarshallClass="org.apache.camel.dataformat.jibx.PurchaseOrder"/>
</dataFormats>

<route>
<from uri="direct:marshall"/>
<marshal ref="jibx"/>
<to uri="mock:result"/>
</route>
<route>
<from uri="direct:unmarshall"/>
<unmarshal ref="jibx"/>
<to uri="mock:result"/>
</route>

</camelContext>


h3. Dependencies

To use JiBX in your camel routes you need to add the a dependency on *camel-jibx* 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|Download]).

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jibx</artifactId>
<version>2.6.0</version>
</dependency>

 
  • No labels