Thursday, June 28, 2012

Cloud Integration with Fabric Camel (Part I)

Since the launch of Fuse ESB 7, Fuse MB 7 and in fact the official release of Fuse Fabric, Camel has moved in a new era called "Cloud Integration where machines, services are distributed everywhere.
FuseSource (which is now part of RedHat company) is the leader of "Integration Everywhere" has supported the development of the Fabric project to facilitate the creation of such integration project in the "cloud".

With Fabric, the information of the Camel endpoints are registered in a global registry which can be accessed by the different machines part of the cloud. This mechanism which is presented here

You Tube link of the video :

requires some Fabric agents which are used to communicate with the registry (= Fabric ensemble). This ensemble is in fact a Zookeeper server which will contain configurations, profiles and of course services registered. When a Camel producer wants to publish a camel exchange, it will perform a lookup in the registry to find endpoints using as a key the name associated to a fabric group.
The endpoints available are returned as a list :

zk:list -r -d fabric/registry/camel
endpoints/local/00000000000 = jetty:
endpoints/local/00000000001 = jetty:

As Fabric agents which are deployed in Fabric containers can be added or removed dynamically according to the needs, this list is continuously refreshed. The endpoint registered could be of type Jetty, CXF, Mina, Netty, JMS as they are able to transport information from a machine to another using HTTP, JMS, TCP/IP ... protocols.
The other advantage of this mechanism is that the Camel producer when communicating with Fabric will use a internal loabalancer if more than one Camel route exposing the service has been deployed in several Fabric containers.

To deploy a Fabric Camel project, you just need to use some of the Fabric commands to create the profiles of the camel routes exposed as service and also used to consume the services. With such profiles, we can create Fabric containers and deploy the camel routes as the following video will show you

Youtube Link of the video :

The code of the demo is available here :

Enjoy Cloud Integration Camel Rider !

Thursday, April 26, 2012

Real Time HTML5 application with Websocket and ActiveMQ/camel

As part of my CamelOne presentation, I have prepared some examples to dig into what Apache ActiveMQ and Camel propose to work with HTML5 and WebSocket technology.
Developing "Real Time Web Applications" has always been painful not matter if the technology used was based on Java Applet, Adobe Flash, Adobe ShockWave, Microsoft Silverlight and the protocol (HTTP, RMI, ...).

Since HTML5 publication (2009) and the work done by W3C and IETF organisations, we now have a standard rfc-6455 that we can use to exchange in a bi-directional way "messages" between the browser and the Web Server. Only one HTTP(s) request is required to initiate the WebSocket communication and later on the exchange of data frames (text or bytes).

ActiveMQ (release 5.6) like Camel (release 2.10) proposes a WebSocket Transport Connector or Endpoint using Jetty WebServer WebSocket implementation (v7.5). This allow not only to retrieve data from topics but when combining the EIP patterns of Camel and some components like : sql, jpa, file, rss, atom, twitter, ... we can "aggregate", "enrich" or "filter" content receive from feed providers before to publish them for feed consumers.

ActiveMQ uses Stomp as a wired format to send WebSockets messages between the WebSocket server running within the ActiveMQ broker and the Web browser. In this context, we must use one of the two javascript librairies available (stomp.js, stomple) to develop the project

    $(document).ready(function() {
       var client, destinationQuotes;
        $('#connect_form').submit(function() {
            var url = $("#connect_url").val();
            client = Stomp.client(url);

            // the client is notified when it is connected to the server.
            var onconnect = function(frame) {

                var stockTable = document.getElementById("stockTable");
                var stockRowIndexes = {};

                client.subscribe(destinationQuotes, function(message) {
                    var quote = JSON.parse(message.body);
                    $('.' + "stock-" + quote.symbol).replaceWith("" +
                        "" + quote.symbol + "" +
                        "" + + "" +
                        "" + quote.last.toFixed(2) + "" +
                        "" + quote.change.toFixed(2) + "" +
                        "" + quote.high.toFixed(2) + "" +
                        "" + quote.low.toFixed(2) + "" +

        client.connect(login, passcode, onconnect);

and of course the WebSocket protocol must be enable.

Camel does not need a special format to exchange the data between its WebSocket endpoint and the browser as JSon text will be send through the WebSocket Data Frames to the browser. We must just expose a Camel Route as a WebSocket Server.

public class WebSocketStockPricesRoute extends RouteBuilder {
    public void configure() throws Exception {

             .log(LoggingLevel.DEBUG,">> Stock price received : ${body}")


and use in the browser the WebSocket HTML5 js script.

    var socket;
    $('#connect_form').submit(function () {

        var stockTable = document.getElementById("stockTable");
        var stockRowIndexes = {};
        var host = $("#connect_url").val();
        socket = new WebSocket(host);

       // Add a connect listener
        socket.onopen = function () {
Socket Status: ' + socket.readyState + ' (open)
'); } socket.onmessage = function (msg) { // $('#msg').append('
Received: ' + + "
"); var quote = JSON.parse(; ....

In both cases, you can combine other javascript librairies (jquery, jquery-ui) to improve the design of the JSon objects to be displayed in the browser.

Here are some screenshots about the demos

Stock Trader
Chat Room

Twitter and News Feed

Code can be retrieved from FuseByExample web site. Look to "websocket-activemq-camel" git hub project.

Enjoy WebSocket with Apache Camel and ActiveMQ.

Friday, April 13, 2012

3 reasons to use FuseSource Documentation

As an Apache Committer but also FuseSource Consultant and Solution Architect, the documentation and its quality is a critical factor in my day by day work. Until now, even using google search engine, that was difficult to find in one place all the information required and a wasting time.
This situation has changed and I will give you three reasons to use/adopt FuseSource documentation for your Apache Camel, Apache ServiceMix and Apache Karaf projects.

Reason 1 :  Fuse maintains history of Apache releases
Apache websites uses Atlassian Confluence to maintain content publishes for each Apache project. This tool does not allow to create a history of the different releases of Camel by example (2.6, 2.7, 2.8). This is not the case with FuseSource documentation which allow you to browse a specific version like the current. And with the help of google, you can make specific search like that "followed by the keywords"
or "followed by the keywords"

Reason 2 : Javadoc and Schema are well documented
Javadoc like XML Schema are also 2 interesting examples as there is no XML Schema javadoc on Apache websites for by example Spring DSL language. This is completely different on FuseSource web site as you can read the documentation and discover what are the tags or attributes to be used for specific Apache Camel DSL words. Here is an example containing the options proposed for Apache Camel Dataformat.

Reason 3 : New chapters have been added
FuseSource documentation contains missing pieces of information or cover in depth points which are described poorly on Apache websites or in an disparate way. So take the time to read the following chapters when you need more info about Transactions, Security, ...

  • Camel and Transactions :
  • Camel and WebServices :
  • Fuse ESB - Security guide :
  • Transactions with Fuse ESB :
  • ActiveMQ - Security :
  • ActiveMQ - Tuning Guide :

Apache Camel at CamelOne

FuseSource organises for the second time an event dedicated to the famous Apache Camel EIP Framework - CamelOne, the 15th  and 16nd of May. This conference is not only a vitrine dedicated to Apache Camel Integration framework or FuseSource products but related technologies like ESB, SOA, BPM, Cloud, MOM, HTML5, Big Data and Real Time applications will be presented through a panel of different CamelOne talks and speakers (Rob Davies, James Strachan, Claus Ibsen, Hiram Chirino, Tony Shan, Robin Howlett, Dan Kulp, Jon Anstey, Kai Wahner, Charles Moulliard, Jazon Van Zyl, ...).

A special attention was also given this year to present projects deployed and running in Enterprise (Christian Mueller - Atos, Rob Terpilowski - Lynden, Matt Pavlovich - Media Driver, David Reiser, Ram Raju and Shane Kent -- Department of Transportation, Robin Howlett - Silver Chalice) proving that Apache Camel is not only used by early adopters but is now part of the Enterprise Software Architecture like RDBMS and Web Technologies. 

If your are not yet registered, I recommend to do it to have the chance to meet some Apache Committers and people working every day with SOA and Integration projects. This is incredible opportunity which is only offered one time a year. Do not forget that the CamelOne conference include also a program to train people on Apache Camel, ActiveMQ and Apache ServiceMix.

Friday, December 16, 2011

Run a Google Web Toolkit 2 project on Apache Karaf/ServiceMix

To simplify the development of Web projects on Apache Karaf/Apache ServiceMix, we have created archetypes to setup WAR or WAB projects. They are very basic but they can be enriched with framework like Struts 2, Wicket, plain JSP or MyFaces JSF as they are currently supported on Apache Karaf - ServiceMix.

For the GWT users, it exists now an archetype which will create a GWT 2.4 project. To create such a project, you must generate a project from the archetype

mvn archetype:generate \
   -DarchetypeArtifactId=wab-gwt-archetype \
   -DarchetypeVersion=2.1.2 \
   -DgroupId=com.mycompany \
   -DartifactId=hello \

build next the WAB using hello/mvn clean install

and deploy it on Apache Karaf

Verify that the web site is well registered :

Next, you can navigate to your application in your browser and click on the button to say Hello.

Remark : A WAB project is nothing more than a WAR excepted it is packaged as a bundle file, that we have removed the WEB-INF/lib dependencies and create a MANIFEST file containing the OSGI instructions.

Monday, November 21, 2011

Apache Camel, Cxf, ActiveMQ & ServiceMix at Devoxx

This year, I get the chance to present 2 talks at the Devoxx event,

one for University Talk and the other for Hands on Lab. With the help of Gert Vanthienen, we took the time to present in more detail what finally we can design as solution, architecture with Apache projects like Camel, CXF, ActiveMQ and ServiceMix and move it into a scalable, high-available platform.

That was a great challenge as this is not really easy to introduce "integration" which is not so sexy comparing to a Web Development framework, an iPhone or Android application. But times are changing and a lot of developers / architects are interested by agile approaches that we develop at Apache foundation.

With Fuse IDE tool,we can now accelerate the creation of a project using Apache Camel. The wysiwig editor and EIPs patterns allow you to quickly create new routes while the runtime editor enable to review existing project. IDE is more than a tool as it allows to run and deploy the routes in Fuse ESB, Tomcat application servers or locally. The tool is not yet finalized (release 2.1 should be available soon) but it offers a lot of possibilities to facilitate integration projects, tracing of messages (= exchanges) and investigation about time passing through the different processors.

Integration projects are moving into cloud space and this is what we have presented next with FuseSource Fabric. Fabric is not a new hype but a strategy to reduce impact of OSGI dependencies calculation, provisioning of Apache Camel routes on local, remote or cloud instances using Apache Zookeeper as registry of artefacts to be deployed (features, jars, configurations). It offers also elastic services when deploying services into the cloud.

For those who were not there, here are the links of the presentation like also the hands on lab material that we have used in the afternoon to develop a real Japa Application Project (Spring, JPA, Web) on Fuse ESB.
Remark : The step by guide is available on the github repo like also the skeleton (zip file)

Thursday, February 24, 2011

Talks about Integration with Camel and ESB

This year, I plan to make some talks about Apache ServiceMix, Apache Camel, apache ActiveMQ and show how easy it is to build integration solutions with Apache technologies.

Take free time, a two break hours and joint me during one of the following events :


The purpose of this presentation/demo is to show you how easy it is to design integration between systems (web services, file systems, database, queue engine) using the projects Camel, ServiceMix and ActiveMQ of the foundation Apache.

First part :

Presentation of the projects Camel, ServiceMix and ActiveMq
Description of the topologies proposed : messaging, osgi, web, ...
High-availability and scalability (ServiceMix and/or ActiveMQ)

Second part :

Making of of the demo solution
Transpose it into camel DSL language
Coding of WebService (using Apache CXF), DAO and Persistence layer (Spring + Hibernate JPA) and Web layer (Apache Wicket),
Development of Camel routes,
Packaging and Deployment