Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

JAXB is a Data Format which uses the JAXB2 XML marshalling standard which is included in Java 6 to unmarshal an XML payload into Java objects or to marshal Java objects into an XML payload.

Using the Java DSL

For example the following uses a named DataFormat of jaxb which is configured with a number of Java package names to initialize the JAXBContext.

...

Code Block
from("activemq:My.Queue").
  unmarshal("myJaxbDataType").
  to("mqseries:Another.Queue");

Using Spring XML

The following example shows how to use JAXB to unmarshal using Spring configuring the jaxb data type

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/springDataFormat.xml}

This example shows how to configure the data type just once and reuse it on multiple routes

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/camel/trunk/components/camel-jaxb/src/test/resources/org/apache/camel/example/marshalAndUnmarshalWithRef.xml}