Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Chapter 7. FAB Tutorial
Abstract
This tutorial describes a complete example of how to generate, build, run, and deploy a Apache Camel application as a FAB.
7.1. Generating and Running an EIP FAB Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Overview Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
This section explains how to generate, build, and run a complete Apache Camel example as a FAB, where the starting point code is generated with the help of a Maven archetype.
Prerequisites Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
In order to generate a project using an Red Hat JBoss Fuse Maven archetype, you must have the following prerequisites:
- Maven installation—Maven is a free, open source build tool from Apache. You can download the latest version from http://maven.apache.org/download.html (minimum is 2.0.9).
- Internet connection—whilst performing a build, Maven dynamically searches external repositories and downloads the required artifacts on the fly. In order for this to work, your build machine must be connected to the Internet.
- fusesource Maven repository is configured—in order to locate the archetypes, Maven's
settings.xml
file must be configured with the location of thefusesource
Maven repository. For details of how to set this up, see the section called “Adding the Red Hat JBoss Fuse repository”.
Generating an EIP FAB Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The
camel-archetype-blueprint
archetype creates a sample Maven project that can be deployed as a FAB. To generate a Maven project with the coordinates, org.fusesource.example:camel-fab
, enter the following command:
The result of this command is a directory,
ProjectDir/camel-fab
, containing the files for the generated FAB project.
Running the EIP FAB Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To install and run the generated
camel-fab
project, perform the following steps:
- Build the project—open a command prompt and change directory to
ProjectDir/camel-fab
. Use Maven to build the demonstration by entering the following command:mvn install
mvn install
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If this command runs successfully, theProjectDir/camel-fab/target
directory should contain the JAR file,camel-fab-1.0-SNAPSHOT.jar
and the JAR will also be installed in the local Maven repository. - Install and start the camel-fab JAR—at the Red Hat JBoss Fuse console, enter the following command:
JBossFuse:karaf@root> install fab:mvn:org.fusesource.example/camel-fab
JBossFuse:karaf@root> install fab:mvn:org.fusesource.example/camel-fab
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the FAB is successfully installed, its bundle ID is logged to the console window. Using this bundle ID, bundleID, start the FAB by entering the following console command:JBossFuse:karaf@root> fab:start bundleID
JBossFuse:karaf@root> fab:start bundleID
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After entering this command, you should soon see output like the following being logged to the console screen:>>>> MyTransform set body: Mon Sep 22 11:43:42 BST 2011 >>>> MyTransform set body: Mon Sep 22 11:43:44 BST 2011 >>>> MyTransform set body: Mon Sep 22 11:43:46 BST 2011
>>>> MyTransform set body: Mon Sep 22 11:43:42 BST 2011 >>>> MyTransform set body: Mon Sep 22 11:43:44 BST 2011 >>>> MyTransform set body: Mon Sep 22 11:43:46 BST 2011
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Stop the camel-fab bundle—using the FAB's bundle ID, bundleID, stop the
camel-fab
bundle, as follows:JBossFuse:karaf@root> fab:stop bundleID
JBossFuse:karaf@root> fab:stop bundleID
Copy to Clipboard Copied! Toggle word wrap Toggle overflow