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

video

You Tube link of the video : http://www.youtube.com/watch?v=CO1WcTFivT0

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:http://0.0.0.0:9090/fabric
endpoints/local/00000000001 = jetty:http://0.0.0.0:9191/fabric


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

video

Youtube Link of the video : http://www.youtube.com/watch?v=RUg2rgY4BME

The code of the demo is available here : https://github.com/fusesource/fuse/tree/master/fabric/fabric-examples/fabric-camel-cluster-loadbalancing

Enjoy Cloud Integration Camel Rider !