Repository: camel Updated Branches: refs/heads/master 773547a2e -> 5d95d0fff
Added camel-jibx dataformat docs to Gitbook Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d95d0ff Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d95d0ff Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d95d0ff Branch: refs/heads/master Commit: 5d95d0fff699fececd94422389db93d1de9add36 Parents: 773547a Author: Andrea Cosentino <anco...@gmail.com> Authored: Thu Apr 28 09:15:53 2016 +0200 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Thu Apr 28 09:15:53 2016 +0200 ---------------------------------------------------------------------- components/camel-jibx/src/main/docs/jibx.adoc | 81 ++++++++++++++++++++++ docs/user-manual/en/SUMMARY.md | 1 + 2 files changed, 82 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5d95d0ff/components/camel-jibx/src/main/docs/jibx.adoc ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/main/docs/jibx.adoc b/components/camel-jibx/src/main/docs/jibx.adoc new file mode 100644 index 0000000..a49bf89 --- /dev/null +++ b/components/camel-jibx/src/main/docs/jibx.adoc @@ -0,0 +1,81 @@ +[[JiBX-JiBX]] +JiBX +~~~~ + +*Available as of Camel 2.6* + +JiBX is a link:data-format.html[Data Format] which uses the +http://jibx.sourceforge.net[JiBX library] to marshal and unmarshal Java +objects to and from XML. + +[source,java] +----------------------------------------------------------- +// lets turn Object messages into XML then send to MQSeries +from("activemq:My.Queue"). + marshal().jibx(). + to("mqseries:Another.Queue"); +----------------------------------------------------------- + +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. + +[source,java] +------------------------------------------- +// lets turn XML into PurchaseOrder message +from("mqseries:Another.Queue"). + unmarshal().jibx(PurchaseOrder.class). + to("activemq:My.Queue"); +------------------------------------------- + +[[JiBX-JiBXSpringDSL]] +JiBX Spring DSL +^^^^^^^^^^^^^^^ + +JiBX data format is also supported by Camel Spring DSL. + +[source,xml] +-------------------------------------------------------------------------------------- +<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> +-------------------------------------------------------------------------------------- + +[[JiBX-Dependencies]] +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 +link:download.html[the download page for the latest versions]). + +[source,xml] +------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-jibx</artifactId> + <version>2.6.0</version> +</dependency> +------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5d95d0ff/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index b0d9e0b..252fcb4 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -196,6 +196,7 @@ * [Flatpack](flatpack-dataformat.adoc) * [Ical](ical.adoc) * [Jaxb](jaxb.adoc) + * [Jibx](jibx.adoc) * [XML JSON](xmljson.adoc) * User Guide