Camel is an amazing routing engine serving as a core for the best ESB implementation ever i.e. ServiceMix. JiBX is the high performance XML binding library for Java.
Since now you can (un)marshal your Camel messages with out of the box JiBX support, without need to create your custom JiBX components.
New JiBX component will be available with the 2.6.0 release of Apache Camel.
You can use JiBX component with both Java DSL...
// Marshal message to XML using Java DSL. from("activemq:My.Queue"). marshal().jibx(). to("mqseries:Another.Queue"); // Unmarshal message from XML. from("mqseries:Another.Queue"). unmarshal().jibx(PurchaseOrder.class). to("activemq:My.Queue")
... and Spring DSL...
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <!-- Define data formats --> <dataFormats> <jibx id="jibx" unmarshallClass="org.apache.camel.dataformat.jibx.PurchaseOrder"/> </dataFormats> <!-- Marshal message to XML --> <route> <from uri="direct:marshal"/> <marshal ref="jibx"/> <to uri="mock:result"/> </route> <!-- Unmarshal message from XML --> <route> <from uri="direct:unmarshal"/> <unmarshal ref="jibx"/> <to uri="mock:result"/> </route> </camelContext>
Enjoy.
No comments:
Post a Comment