Open Source

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.

Competition in open source is healthy

October 29th, 2007  |  Published in Open Source  | Add to del.icio.us

I read Sanjiva’s post on the $subject and like to add my own observations. It is true that the Apache Web Server is the statue of liberty that stands tall among all the commercial web servers out there and has no peers in open source. However that is an isolated use case. We need to think more pragmatically. The predictions are such that, most companies, in the future will have some form of involvement with Open Source. Naturally there will be some form of competition, and it is unavoidable. But the more choice (open source or otherwise) a user has the better it gets, especially if there are several open source alternatives instead of one. If there is only one open source alternative and the user ends up with a bad experience with that solution, it can color the perspective of how that company, will look at open source in general.

Competition provides choice and facilitates continuous growth and innovation in open source solutions. It drives a community to be more responsive and responsible towards it’s end users. This results in better support in the form of fixing bugs or answering questions on the list. Bcos if you are not growing or innovative or if you are not responsive or responsible towards the end users then they will look elsewhere. One could argue that there are companies that provide support. However one should not forget that these companies are built on top of the community and rely heavily on the community for it’s success. And any fixes/patches they make usually go upstream. Companies that don’t usually have problems and fade away.

Sometimes you would find that some community members are unhappy with the current direction of a project and they go ahead and form another project. The difference in direction or focus is perhaps an integral part of the evolutionary process. Some of these projects eventually create a company behind it. One could also argue that these companies fragment a community and promote competition. As long as this competition is both ethical and within the norms of standard industry practice, then the end users benefit from it. Why?? Bcos these companies will drive innovation, creativity and quality of the solutions they support, as their business model is based on it.

Therefore some form of competition that is ethical (not mud slinging or cut throat competition) is healthy for making open source a viable option in enterprise software. The process of evolution will weed out inferior solutions and ensure the survival of the fittest. However this should not be based on how much marketing muscle a project/company behind it has, but rather be based on the community aspect and technical merits.

Benchmark Wars

February 9th, 2007  |  Published in Axis2, Open Source  | Add to del.icio.us

The recent posts by Paul, Dims and Dan have provided benchmarks pitting Axis2 vs XFire. I think that is a very good step and provides end users some good information. Also I would like if everybody provided the source code for these tests so non believers and end users can run it for themselves.

However, racist ranting with no performance numbers to back it up is not acceptable at all. If a person cannot explain a technical argument without subjecting him self to such a low level, then I don’t think the rest of world should care.

Dan I welcome your effort to work out the performance numbers. That is the right approach. Healthy competition will only promote WS-* and help dispell the myth that SOAP is slow. If either Axis2 or XFire is slow in this round then let the respective teams make sure that they make an effort to beat the other in the next round. Now that is whats going to make each other better, not unwarranted racist comments that shows your sorry upbringing and publicly disgracing your parents.

However Dan I believe that most enteprise systems do care about RM and Security (Addressing too). So there will be SOAPHeaders. With more SOAP stacks supporting these specs there will be an increase in the adoption of these standards in the enterprise world and so IMHO the SOAPHeaders should be part of the performance tests. However I also recognize the need for being efficient in the POX case too. As Dan said the POX use case maybe a popular one with SME’s. If Axis2 is lagging behind in that area then we as a team can work on the performance.

As for Hani, he is still motivated to spew out his garbage for the very same reason why Howard Stern is still in business. There is and will always be an audience for these type of people. Some would call it “Freedom of expression”, others like me would see it as an abuse of the that very sacred principle.

ApacheCon US 06

October 26th, 2006  |  Published in Open Source  | Add to del.icio.us

Finnaly I settled down to write something about Apache Con US 06, eventhough it’s been about 2 weeks since I’ve been there. It was held in Austin, TX and I have to say it was very good. I went out for dinner a couple of times, and enjoyed all the live music that was going on, on 6th Street. Well they say Austin is the live music capital of the world….not sure I agree there.

Anyways I had a good time and met a lot of friends that I have only communicated through email/IM. I also presented on Axis2. The focus was on the usage of Axis2 with spring, pojo support, embedding being the main topics I coverd during the presentation.

I loved the keynote by Dr. Cliff Stoll and I also managed to get Howard Taylor a cartoonist to draw a small caricature of me with a cricket bat.

I met Roy Fielding the guy who invented HTTP and REST. But what really spoiled the whole thing was when I realized that somebody has taken my digital camera. I am pretty sure it was the hotel staff.

My First Podcast

September 29th, 2006  |  Published in Open Source  | Add to del.icio.us

I finnaly started to blog again. The last time I bloged was in January and then I slacked off.
So this time hopefully I will keep up to it. Lots of things happend between January and now and I feel bad that I didn’t blog about it.

Anyways I was fortunate enough to do a podcast about Apache Axis2 with Rich Bowen for feather cast. This was done at the Apache Con Asia 06 where I was a speaker for the first time at a conference of this magnitutde. Here is the link to my podcast http://feathercast.org/?p=26