Gert Vanthienen's blog

Saturday, July 3, 2010

Camel async routing in ServiceMix

Until recently, servicemix-camel did not allow asynchronous interaction with the NMR. Every MessageExchange was being sent using sendSync(), causing the calling thread to wait for the MessageExchange to finish.

Let's take a look at this set of Camel routes:

from("jbi:endpoint:urn:test:service:endpoint1")
.to(""jbi:endpoint:urn:test:service:endpoint2");
from("jbi:endpoint:urn:test:service:endpoint2")
.to(""jbi:endpoint:urn:test:service:endpoint3");
from("jbi:endpoint:urn:test:service:endpoint3")
.to(""jbi:endpoint:urn:test:another_service:endpoint");


When sending an exchange to endpoint 1, the diagram below shows how this invocation will cause three threads to be waiting until the entire flow ends.


For the upcoming Camel 2.4.0 release, Claus Ibsen has been working hard to add fully async routing to Camel again. The servicemix-camel and camel-nmr components have already been upgraded to leverage his hard work, because this improvement completely changes the picture for JBI and NMR integration.

As you can see below, the threads are now no longer waiting, but are available to pick up new work while the initial flow of MessageExchanges is still ongoing.


If you're using Camel inside ServiceMix, make sure you pick up the next version of Apache ServiceMix or FUSE ESB to benefit from these scalability improvements.

4 Comments:

  • Good work! I have been waiting for this feature forever.

    By Blogger lekkie, At July 4, 2010 at 8:56 AM  

  • And this time all the EIP patterns supports the async routing engine, so you can do pipes and filters, routing slip, recipient list, load balancing, error handling, redelivery etc.

    In 1.x there where only a selected number of EIPs supported.

    By Blogger Claus Ibsen, At July 4, 2010 at 9:03 AM  

  • When is it going to be added to the maven repository?

    By Blogger lekkie, At July 4, 2010 at 12:58 PM  

  • @Claus: Yeah, you're really doing an awesome job implementing this -- we can almost see more and more of our unit tests in ServiceMix run asynchronously as you make progress!

    @Lekkie: The latest snapshots at https://repository.apache.org/content/repositories/snapshots/org/apache/servicemix/servicemix-camel/2010.02-SNAPSHOT/ already have this feature -- I expect we'll have a release as soon as we finished the next two items on our todo list: migration to Spring 3 and upgrade to the new Karaf kits

    By Blogger Gert Vanthienen, At July 5, 2010 at 6:30 PM  

Post a Comment

Subscribe to Post Comments [Atom]



<< Home