Available as of Camel 2.6

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

Please note that marshaling process can recognize the message type at the runtime. However while unmarshaling message from XML we need to specify target class explicitly.

// lets turn XML into PurchaseOrder message

JiBX Spring DSL

JiBX data format is also supported by Camel Spring DSL.

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

  <!-- Define data formats -->
    <jibx id="jibx" unmarshallClass="org.apache.camel.dataformat.jibx.PurchaseOrder"/>

  <!-- Marshal message to XML -->
    <from uri="direct:marshal"/>
    <marshal ref="jibx"/>
    <to uri="mock:result"/>

  <!-- Unmarshal message from XML -->
    <from uri="direct:unmarshal"/>
    <unmarshal ref="jibx"/>
    <to uri="mock:result"/>



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).

  • No labels