Blog de Nicolas DUMINIL

Lasciate ogni speranza vuoi che entrate qui !

A Hello World Example with Camel and FSW

Publié le 27/03/2014

Red Hat’s newborn Fuse Service Works (FSW) is the last release of the JBoss SOA Platform, previously known under the name of SOA-P. As opposed to its previous SOA-P versions, FSW is more than simply a new release of the same product, but a completely new implementation by Red Hat of the OASIS SCA (Service Component Architecture) Assembly Model published in 2011. This implementation by Red Hat, known under the name of JBoss Switchyard, which is also a community project, is the base of the new FSW. Besides Switchyard, the SOA (Service Oriented Architecture) Governance is the other cornerstone of FSW and its support is JBoss Overlord, another community project, which is an implementation of the OASIS SOA Repository Artifact Model and Protocol (S-RAMP) specifications.


But this enumeration of specifications and standard proposals might be confusing. Accordingly, in this article we’ll try to follow a practical approach to understand FSW based on a simple example. In order to follow-up this example, you need the following elements:


  1. An installation of JBoss Fuse Service Works 6.1
  2. An installation of JBoss Development Studio 7.1
  3. The downloaded from the download page of this page.


The hello-world-fsw-camel sample is basically a Camel route which uses the timer component to display a greeting message in the application server log file, every 10 seconds. So, as you may see, nothing of very spectacular. The rationale of this example is to demonstrate how easy one can deploy and run Camel routes in FSW, compared to OSGi platforms like Apache Karaf or JBoss Fuse, where these same operations are more difficult and complex.


The most important component of the sample is the class CamelActivator which uses the Java EE 6 @Singleton and @Startup annotations. As any start-up class, i.e. a class which instantiated at the server start-up time or at the bundle deploy time, it implements the init() method in which the Camel context is created and started. This is the way that one may bootstrap Camel in a non OSGi container such as FSW. Symmetrically, the method stop() of the same class cleans-up and stops the Camel context.


The class contains an injection point containing an instance of HelloWorldCamelRoute, which is an extension of the org.apache.camel.builder.RouteBuilder and which defines to route to be executed. This route triggers a timer every 10 seconds and, when it fires, the bean fr.simplex_software.fsw.camel.HelloWorld is invoked and its return vale is logged in the application server log file using the logEIP Camel component.

This is all folks. You may import the project in JBDS, after having downloaded it from this web site download page, as an existent Maven project. In order to build and deploy it, the following command is required:


                mvn clean install jboss-as:deploy


The FSW server needs to be started, of course. You will need to define the appropriated maven repositories and, for the beginning, the easiest would be to use the settings.xml file downloaded from the same page of this web site. Once the project deployed, the log file will show a Hello World message every 10 seconds. To stop the route and undeploy the bundle you need to run the following command in the project’s root directory:


                mvn jboss-as:undeploy


Now, you may define more complex routes and use all Camel’s power without bothering any more with deployment details. The only thing you need is a start-up singleton which init() and stop() methods are responsible for starting/stopping your Camel routes.

Envoyer à un ami

* champs obligatoires

* champs obligatoires

« Les informations recueillies font l’objet d’un traitement informatique destiné au traitement de votre demande. Le destinataire des données est Simplex Software. Conformément à la loi « informatique et libertés » du 6 janvier 1978 modifiée en 2004, vous bénéficiez d’un droit d’accès et de rectification aux informations qui vous concernent, que vous pouvez exercer en vous adressant à Simplex Software, 26 Allée des Sapins - 95230 Soisy sous Montmorency. Vous pouvez également, pour des motifs légitimes, vous opposer au traitement des données vous concernant. »