General

Synapse vs Camel

February 11th, 2008  |  Published in General, Open Source  | Add to del.icio.us

I had the opportunity of listening to my friend Bruce Snyder talk about Apache Camel during his talks on ActiveMQ/ServiceMix at the Colorado Software Summit 07. There was also some discussion on Camel on the Apache Synapse mailing list recently. I thought of replying to the thread comparing the two based on it’s routing and mediation aspects. In the process I decided to write a blog post instead. If I have misunderstood any Camel feature/architectural detail, please let me know and I will post a correction. Note this is not an in depth analysis, neither a verdict on either project. Readers should do their own research and come to conclusions.

Intent/Problem Space

  • Both Synapse and Camel have similar intents as Integration, Mediation and Routing Engines.
  • Synapse also positions itself as an ESB, treating your entire network as the bus.
  • Camel/ServiceMix is advertised as an ESB.
  • Both have routing,transformation,mediation,enrichment,validation, logging ..etc.
  • Initially Synapse was more focused on Web Services mediation. Since then, it has moved out of the Web Services umbrella and is trying to position itself as a general purpose integration/mediation/routing engine.
  • Synapse by design have a proper abstraction layer where you can adapt (implement) Synapse on top of any Environment. It is one of the least known aspects about Synapse. Most folks assume Synapse can only work on top of Axis2. I have implemented the Synapse environment interface inside the Apache Qpid broker to leverage its mediation/routing capabilities.
  • Camel on the other hand was designed to work on different environments from the begining. Camel can be used inside ServiceMix, ActiveMQ etc.

I haven’t experimented enough with Camel to compare performance, flexibility,extensibility or robustness with Synapse. Perhaps that would be an interesting topic to touch sometime later

Messaging Model

  • The Synapse messaging model is based on SOAP. The current implementation of Synapse is powered by Axis2 and takes any type of non SOAP message and creates a fictitious SOAP message and pumps it through the Synapse engine.
  • Camel has a neutral messaging model which I think is nice.
  • However you can implement your own Synapse MessageContext as well. I have created an AMQP based messaging model for Synapse for my work on embedding Synapse as an AMQP Exchange.
  • Synapse could also use generics to make it’s messaging model neutral. (I hope to make a proposal to this effect after my AMQP work).

Synapse Configuration vs Camel Context

  • Both use very similar models for representing a runtime instance of the rules/endpoints/registry ..etc.
  • Synapse has a XML based DSL for configuration.
  • Camel has a java and XML based DSL for configuration. You can use Spring to configure the Camel Context as well.
  • You can also use Synapse programatically all though we haven’t provided a clear API as such to the user community. I think such an API would be a valuable addition to Synapse.
  • There is support for configuring Axis2 with Spring, so I assume you can do the same for Synapse very soon (if not already).
  • Both supports the concept of a Registry. The registry mechanism is pluggable in both projects.

Synapse Mediators vs Camel Processors

  • A Synapse mediator, mediates a message as it passes through. It could be a transformation,validation, logging, audit ..etc.
  • You can chain mediators into sequences and combine different sequences to create a processing engine.
  • Camel processors does more or less the same.
  • In both Synapse and Camel you can write you own mediator by implementing the Mediator or Processor interfaces respectively.

Synapse Script Mediator vs Camel Predicates/Expressions
Again they both provide pluggable scripting support. Not much to be said there.

Endpoints/Transports

  • Both represents endpoints via URIs.
  • Camel and Synapse supports more or less the same set of transports with the following exceptions.
    • Camel has additional support for JBI,MINA, XMPP.
    • Synapse supports Non blocking HTTP, AMQP (native not via JMS).
      James Strachenanswered : “Camel supports non blocking HTTP too”
    • In Synapse you could switch transport. Ex incoming is JMS and outgoing is HTTP (does Camel have similar support?).
      James Strachen answered : “you can use Camel to do protocol switching from any protocol to any protocol with whatever EIP patterns in between (e.g. Message Translator etc).”
    • Axis2 has support for XMPP, so if you really want to you could leverage that in Synapse.

Enterprise Integration Patterns

  • Camel has support/good documentation for Enterprise Integration Patterns (based on Gregor Hopes book).
  • All though Synapse doesn’t directly say so, you can easily do the same. In fact it does have some built in support similar to Camel for some patterns while other patterns can be done with a little bit of work. I may in the future compile an article on how to do so with Synapse.

Embedability

  • Camel has a programmable API as described above and I quite like it. It would be nice if Synapse can do something similar.
  • Camel can be used inside ServiceMix, ActiveMQ ..etc. I have managed to embed Synapse inside an AMQP broker albeit with some code changes.
  • It would be nice if you could embed the mediation engine in Synapse in other projects in a trivial way and also provide some documentation on it.
  • One nice thing about Synapse is that it can be deployed as a module inside Axis2 or as war file inside Tomcat. Couldn’t find any documentation on easy Camel integration with Apache CFX
    James Strachen answered : “its trivial to deploy Camel inside any Spring or WAR application or as an OSGi bundle, working great with Spring Dynamic Modules”

WS-* QoS Support

  • Synapse has Built in support for WS-* QoS features (adding/removing security, reliability ..etc) when running on top of Axis2.
  • Does Camel have a similar strategy with it’s Apache CXF support? ( I couldn’t find any information in the Camel site about this)
    James Strachen answered : yes Camel has a similar WS-* strategy; using CXF to support the SOAP/WS-* protocols on any endpoint

Throttling/Load balancing/Policy based access and failover support for endpoints

  • Synapse has good support for applying throttling , failover support and load balancing to endpoints.
  • Synapse also can apply policies to enforce restrictions for better manage your endpoints.
  • Not sure if Camel has any support for this area.
    James Strachen answered : “yes Camel has support for load balancing, throttling, resequencing etc. See http://activemq.apache.org/camel/enterprise-integration-patterns.html”

Clustering support

  • Synapse allows mediator state to be replicated across the cluster.This is based on the Axis2 clustering support.
  • This is nice when you want to implement stateful mediators, like a session mediator.
  • Again haven’t come across any documentation in Camel on this area.
    James Strachen answered : “for stateful replication, we rely on ActiveMQ’s Message Groups feature or using EJB3″

Payload Conversion

  • Synapse can covert from one message format to another via built in support for POX, SOAP and JMS.
  • Camel provides a Type Converter interface (and some default implementations) to convert message payloads from one type to another when routing.
  • Similarly in Synapse, for other payload types you could write a custom mediator to do the job.
  • Also using the transport switching mechanism you can do some trivial things like converting a Qpid/AMQP message to an ActiveMQ message using the JMS transport. Sort of like a message bridge.

Summary
Both projects seems interesting and has some overlapping features, but different direction/focus and thought process behind them. IMHO it is nice to have choices in open source. Each community can learn from each other and strive to provide a better experience to the end user.

I REST my case

January 21st, 2008  |  Published in Architecture, General, REST, SOA  | Add to del.icio.us

Mark Baker has hung up his boots on the REST vs SOAP debate. I appreciate his effort in building awareness about the value of REST and convincing people that it provides a solid basis for designing distributed systems. In the same post, Mark also says that, “The war really has been won”. Other REST folks including Stefan Tilkov says more or less the same thing too. I don’t know. In my humble opinion, a few years from now when the systems we design/build today using a RESTful, WS-* (or whatever) approach will show us which approach yields the better result in terms of scalability, extensibility, reliability, interoperability, flexibility, versioning, reusability ..etc. Sure the REST folks would say the web has being there for a while now and it works. But usually there is a human on the other side that drives the interaction. So it remains to be seen whether it will be the same with application-to-application interactions as well.
After all the hype surrounding REST,WS-* etc.. dies out and when people have enough experience building real world applications using both approaches and realizes the advantages and disadvantages of each approach there will be less debate as to which is better, or whether we need both approaches ..etc. The answers to these questions will become more clear to the ordinary folks in time. I for one will have an open mind and is very interested to see the outcome of all of this.

The REST vs SOAP debate has been more emotional/religious and less technical as of late. Several folks burned bridges due to insidious remarks, inflammatory comments and even personal attacks. Irrespective of the technical merits one should be able to tolerate/appreciate differences of opinions and debate in a more disciplined manner than resorting to personal attacks or inflammatory comments. Even if you are the most intelligent person in the world it doesn’t matter if you can’t put forward your technical arguments without degrading your own self by making inflammatory comments or personal attacks.

Global Warming …is it really?

November 1st, 2007  |  Published in General  | Add to del.icio.us

Dwight Hornbecker, the only geologist I’ve even known, had some very interesting facts about global warming. They sound kinda crazy, but I wonder if they are true. Here is what he told.

  • One volcanic eruption can contribute to global warming more than what humans can do in an year
  • The earth was actually warmer than what it is now.

Dwight went onto explain that there is evidence to support that, a few million years ago the earth was a lot more warmer than what it is today. Then came the ice age. And he maintains that we are still recovering from the ice age and earth is slowly returning back to it what it was. Not sure whom to believe. Is it Al Gore and his crew or Dwight?

All I know is that humans haven’t really figured it out yet. We think we do and try to mess around with nature, but I don’t think we are even close at guessing/figuring out the real situation.

Being a single parent (for 2 weeks)

July 3rd, 2007  |  Published in General  | Add to del.icio.us

I had to go to Sri Lanka for my brothers wedding for 2 weeks. My wife was unable to make it due to exams as she is taking summer school. So I decided to go alone with my 3 yr old daughter. I survived the long journey to Sri Lanka thanks to my daughter putting up her best behaviour. The next day we had the wedding and again the little angle held her composure while wearing her dress in extremely hot weather during the photo shoot and church ceremony. We spent the next couple of days going shopping, a trip to the zoo and the beach. I had an extremely good time with my daughter and stayed away from my laptop (except during the Axis2 clustering hackathon at the WSO2 office in Colombo) for two weeks. I rarely checked email :) , instead I played with my kid and made the most of the time. She loved to go in three wheelers (tuk tuk) and insisted they were much more exciting than the kiddies roller coaster at Wonderland :). The return journey was a bit tough due to flight cancellations. We got stranded in Paris for a day, but used that time to relax and rest a bit before making it home.
I am well versed with diaper changing, feeding and putting her to sleep, as I take care of her when ever I work from home. But washing her at least 3 times a day and feeding 3 meals and putting her to sleep was extremely tiring. I wonder how my wife does it everyday while being a full time student. My daughter thinks Sri Lanka is much more exciting and charming with ants, flies and butterflies to chase around, cows and stray dogs all over the place, bumpy rides in three wheelers and grand parents who are ready to care for all her whim’s and fancies. Sri Lanka is indeed a charming place.

He was a visionary…..

June 7th, 2007  |  Published in General  | Add to del.icio.us

I think Sanjiva already blogged on this, but I feel obliged to do so as well.
If not for his efforts and most importantly his vision, Sri Lanka would not have progressed this far in IT. Especially his efforts in the university circuit opened the doors for many kids who otherwise would have missed the opportunity to study IT. I have met him once or twice at (ICT) Institute for Computing Technology at the Colombo university while I was a student when we were organizing an IT exhibition. If I am not mistaken, the ICT itself was his brain child. He was a pioneer in getting the “.lk” domain name.
Sometimes his work was disrupted by political pressure from various sources which didn’t like the contributions the he was making. However he continued to push towards his vision until his last breath.
Well done sir!!!! You made us all proud.

Mahela, I thought u will pull us through !!!

May 1st, 2007  |  Published in General  | Add to del.icio.us

I know enough has been written about the world cup dissapointment, but sadly I haven’t got over it yet. It was a very bad day for us. It started with rain and a shortened game which suited the aussi style of power hitting. The ICC which is quickly turning out to be a joke, and is run by a bunch of idiots who are pass their sell by date, should have postphoned the game. It’s a shame that the 100 overs was not played in a world cup final !!!!
We were at a huge disadvantage with the light deteriorating by the minute and the batsmen under pressure to stay on top of the duckworth lewis score. But yet we displayed courage and fought till the end. However credit should be given where it is due and I have to say Gillchrist played a one of a kind ininings.
I knew mahela from school days and people thought he would be playing for Sri Lanka when they saw him batting at under 13 level. I was in a match with Nalanda college at under 15 level. And Mahela single handedly took that game away from us. He was always a big game player and thought he would pull us through, just like in the semi finals. But a bad umpiring decesion ended all that.
I am looking forward to 2011!!!!

My take on JSR 311, Java API for RESTful Web Services

February 16th, 2007  |  Published in General  | Add to del.icio.us

I think doing this inside the JAX-WS space seems to give the wrong impression. I heard that they were proposing to tunnel REST services through JAX-WS endpoints. But Dan sent me the following link to a blog post by Marc Hadley which gave me some hope.

Sun always messed it up with Web Services. JAX-RPC and JAX-WS were horribly complicated with no apparent benefit other than to say the implementer is J2EE compliant. What a price to pay to have that check box in your marketing literature. They may very well make the REST API equally useless by tying it to those JAX-WS API’s.

Anyways we already have an API for REST in the form of servlets and JSP, but I agree that they weren’t good enough. IMHO they should have improved these APIs and add REST support over there, not inside JAX-WS which will fuel the myth, that REST is an alternative to SOAP, instead of REST is an alternative to SOA.

All REST API’s I have seen so far, are high level annotation driven API’s on top of a HTTP binding (servlets). For example what Dan has in XFire. I strongly believe that REST support should go into an HTTP API (servlets) instead of a WS API.

I am gratefull to see the new year !!! (Please wear seat belts)

January 1st, 2007  |  Published in General  | Add to del.icio.us

I am extreamly gratefull and feel blessed to see the new year considering the motor vehicle accident, I was involved with on the 30th Dec 06. It a was multi-vehicle accident (1 van and 3 cars) that was nothing short of a miracle considering every person involved made it through with only whiplash and one person with mild shock.
It was a routine grocery trip to costco and we were heading back home. I stopped at the lights with just one vehicle in front of us. I heard a bang behind us and before I could even think about it there was a massive bang and our car was violently thrust forward and rear ended the car in front of us. As it turned out a van had rear ended the car behind us and that in turn rear ended our car.
When I looked around I saw the car that hit us has rolled into the ditch beside the road. The car was squashed so bad I was expecting the worse. The van was thrown on to the lane right of us and has stopped parallel to us with the engine collapsed and fuel leaking towards our car.
I quickly got out and yelled to my wife to take the baby out of the car seat and we all moved on to the ditch as there was a risk of fire. The ememergency vehicles arrived in 5 mins and the firefightes took control of the situation.
All passengers were saved bcos of seat belts and considering the damaged to the rear of my vehicle I am glad that my daughter and wife were ok. Three vehicles including ours were totaled. Property can always be replaced but not human lives. So please wear seat belts and be alert when you are on the road.

Last year was the toughest of my life so far. It was also the year which I learned so much about life and realized how precious your family is. But I am proud of my fighting sprit and the effort to keep the ship steady through all the troubled times. Humans have a remarkable ability to adapt and fightback when the going gets tough.

Wish you all a Happy and a Blessed New Year.

What is a RESTful Web Service ?

November 16th, 2006  |  Published in General  | Add to del.icio.us

I have to admit that I am very confused about the term “RESTful Web Services”. REST is one of the most highly missunderstood concepts out there and certainly one the most highly abused terms. For most REST means POX/HTTP GET or POST, simillar to some folks, who think they are doing “Web Services” simply bcos they are using SOAP, WSDL etc while there is utter disregard to loose coupling, service orientation ..etc.

I also see the endless debates on SOAP vs REST. I guess this stems from the fact that most think, REST is POX/HTTP GET or POST. While SOAP is a message format, REST is an architectural style. So there is absolutely no point in comparing apples to oranges.

So what is a RESTful Web Service ?

I have been talking to Roy Fielding on email trying to understand REST and have also been bugging Sanjiva on IM trying to clarify the facts. REST takes a “resource oriented approach” while Web Services (SOA) takes a “service oriented approach”. One can argue that a service is a resource (from a REST POV) and a resource can be exposed as a service (from a WS POV). But there are some fundamental differences in these approaches. IMHO a service should be a more coarse grained concept than a resource. A service may encompass one or more resources. I assume what RESTful services means, is that the respective Web Service obeys the REST principles. How possible is that ? To me this is still a grey area and I will continue to ask this question until I understand this properly.