Book Image

Mastering Apache Camel

By : Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré
5 (1)
Book Image

Mastering Apache Camel

5 (1)
By: Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (15 chapters)
Mastering Apache Camel
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Data format


Camel supports a pluggable data format allowing you to marshall and unmarshall the messages.

For instance, if you receive an XML message from an endpoint, you can:

  • Directly manipulate and transport the XML message in the route

  • Translate the XML to a POJO using JAXB, for instance, JAXB is a data format

Unmarshalling allows you to use a data format to convert from a raw format (XML in the previous example) into a Java object. On the other hand, when you send an exchange to an endpoint, you can marshall the transported object into another format. You specify where you want to unmarshall or marshall and the data format to use.

For instance, you can consume an XML message from a JMS queue, unmarshall using JAXB, and send the resulting object to another JMS queue:

from("jms:queue:orders").unmarshal("jaxb").to("jms:queue:other")

You can also unmarshall files containing a serialized object, and then marshall using JAXB to send the resulting XML message to a JMS queue:

from("file:data/inbox"...