Author: Fuse Team
Level: Beginner
Technologies: Camel,Blueprint
Summary: This quickstart demonstrates how to combine multiple EIPs in Camel in order to solve integration problems.
Target Product: Fuse
Source: https://github.com/jboss-fuse/quickstarts
This quickstart demonstrates how to combine multiple EIPs to solve integration problems.
In this example, an orders file containing several orders for zoos around the world is sent to us.
We first want to make sure we retain a copy of the original file. This is done using the Wiretap EIP.
After saving the original, we want to split the file up into the individual orders. This is done using the Splitter EIP.
Then we want to store the orders in separate directories by geographical region. This is done using a Recipient List EIP.
Finally, we want to filter out the orders that contain more than 100 animals and generate a message for the strategic account team. This is done using a Filter EIP.
In studying this example you will learn:
- how to define a Camel route using the Blueprint XML syntax
- how to build and deploy an OSGi bundle in JBoss Fuse
- how to combine multiple Enterprise Integration Patterns to create an integration solution
- how to use the Wiretap EIP to copy messages as they pass through a route
- how to use the Splitter EIP to split large messages into smaller ones
- how to use a Recipient List EIP to dynamically determine how a message passes through a route
- how to use the Filter EIP to filter messages and execute logic for the ones that match the filter
- how to define and use a bean to process a message
- how to use a
direct:
endpoint to link multiple smaller routes together
For more information see:
- http://www.enterpriseintegrationpatterns.com/RecipientList.html
- http://www.enterpriseintegrationpatterns.com/WireTap.html
- http://www.enterpriseintegrationpatterns.com/Filter.html
- http://www.enterpriseintegrationpatterns.com/Sequencer.html
- https://access.redhat.com/site/documentation/JBoss_Fuse/
Before building and running this example you need:
- Maven 3.1.1 or higher
- JDK 1.7 or 1.8
- JBoss Fuse 6
-
Change your working directory to
camel-eips
directory. *. Runmvn clean install
to build the quickstart. *. Start JBoss Fuse 6 by running bin/fuse (on Linux) or bin\fuse.bat (on Windows). *. In the JBoss Fuse console, enter the following command:osgi:install -s mvn:org.jboss.quickstarts.fuse/beginner-camel-eips/6.3.0.redhat-187
*. Fuse should give you an id when the bundle is deployed *. You can check that everything is ok by issuing the command:
osgi:list
your bundle should be present at the end of the list
To use the application be sure to have deployed the quickstart in Fuse as described above. Successful deployment will create and start a Camel route in Fuse.
- As soon as the Camel route has been started, you will see a directory
work/eip/input
in your JBoss Fuse installation. - Copy the file you find in this example's
src/main/fabric8/data
directory to the newly createdwork/eip/input
directory. - Wait a few moments and you will find multiple files organized by geographical region under
work/eip/output': **
2012_0003.xmland
2012_0005.xmlin
work/eip/output/AMER**
2012_0020.xmlin
work/eip/output/APAC**
2012_0001.xml,
2012_0002.xmland
2012_0004.xmlin
work/eip/output/EMEA` - Use
log:display
on the ESB shell to check out the business logging. [main] Processing orders.xml [wiretap] Archiving orders.xml [splitter] Shipping order 2012_0001 to region EMEA [splitter] Shipping order 2012_0002 to region EMEA [filter] Order 2012_0002 is an order for more than 100 animals ...
To stop and undeploy the bundle in Fuse:
-
Enter
osgi:list
command to retrieve your bundle id -
To stop and uninstall the bundle enter
osgi:uninstall <id>