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

Message Routing


These EIPs are the core routing patterns. It's mostly where Camel provides specific syntax to handle routing.

The Content Based Router EIP

The Content Based Router EIP is a special case of the Message Router EIP.

As we've seen previously, the Message Router EIP is a generic routing EIP defining a conditional routing on the message.

The Content Based Router EIP is used in cases where the condition is based on the content of the body of the message itself. In the Message Router example, the condition was on the extension of the consumed files.

Here, to illustrate the Content Based Router EIP, we create an example that will route the files depending on an XPath predicate in the body of the message.

We create the following route.xml Blueprint description:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <route>
          <from uri=...