Camel 2.6 - Using done files with file/ftp components

The upcoming 2.6 release of Apache Camel now supports using "done files" with the file/ftp components. The "done file" is a marker file which signals that the target file is ready for the consumer. You can use this when exchanging data using files and want to avoid the consumer to pickup the target file before its ready (= done).

Mind that Camel also has a number of other features
for detecting if a file is ready,
 which you can read about the readLock option.

For example if write a file with the name yyyyMMdd-report.txt and want to write a done file using the syntax file name .done, then you can do as follows:


Notice the new doneFileName option where we define the pattern of done file. It supports two dynamic placeholders which is ${file:name} and ${file:name.noext}. The latter is the file name without the extension.

The "done file" must be located in the same directory as the target file.

On the consumer side we can do as follows:


Which tells Camel to only pickup files if a done file exists with that given name pattern.

And all this works as well with the FTP components.


Camel in Action is done

This is a follow up post on what Jonathan announced yesterday - Camel in Action is complete.

This is what Manning told us in an email on December 9th 2010.

     Yes, we're done. More importantly, you're done! Congratulations!!

Lets see if I can dig out some numbers for this project.

First mail: 2009-02-15
Last mail: 2010-12-09
Mail threads: 572 (this is not total number of mails, just number of individual conversations)
MEAP updates: 9
Manuscript completed in: 13 months
Production phase: 5 months
Bestseller: 10th spot all time bestseller 2010 (the book is frequent in top 10 bestseller of the week)
Pages: 542
Chapters: 14
Appendixes: 5

So it all started in start of February 2009, when Hadrian contacted me about this book project. Hadrian responded to Manning on 2009-02-15 which you may say its where the ball started to roll about this project. Hadrian and I had to come up with a book plan later, and all what follows to get the a book project started. Three weeks later we had external people review our book proposal, which provided great feedback.

Manning decided to move forward and on the 2009-03-24 they opened up discussing a contract.
I signed the contract on the 2009-04-02.

We got started on a bumpy ride with the project. It took almost 6 weeks after we where supposed to get started before I finally had cleared my path and was ready to really dig in. So on 2009-07-04 I started OpenOffice and started to dig in.

Hadrian didn't seem to be able to find time to work on the project, so after a while it was clear we needed help, and then Jonathan came aboard. The book project was back on track and we and Manning had regained or trust that we could make this happen.

Jonathan was on a roll from the very start and he crafted a really great chapter 2. A month later we had our deadline to deliver 4 chapters for the MEAP to go online.  On the 2009-10-22 the Camel in Action book was up for sale at Manning. The first goal of our contract was fulfilled.

Then there is a long period with just hard work. I spend nearly all my weekends writing on the book. Some weekend I was able to spend 2 x 8 hours. Others just a couple of hours. I found that I was most productive on the weekends when I could get started in the morning. During weekdays, after work, you would not be able to work as much. Those days was best spent doing polishing, review and the likes.

We wrote and developed the chapters until mid July 2010 where we delivered the final manuscript. That means we handed over 14 chapters. The appendixes would be written thereafter. During the MEAP period we posted 9 updates. I think this is great for our readers, that they would get frequent updates of the book, along as its being written.

We got in talks with Martin Krasser about him being a guest author for a new appendix about Akka and Camel. We are both admires and think the Akka project is really cool. And having Martin write this would be the best as he is in fact committer on both projects and coded the Camel integration in Akka. Yes as a reader you get the information is from the source. Later this month this appendix will be given free at the Manning website. So keep an eye when that happens.

So after 4 - 5 months of being in whats known as the product phase (copy editing, type setting etc.), the book is done.

I recently spoke to Manning about how the sale of the book is going. They are very pleased with the book. We have sold 1807 copies (2010-12-05) from MEAP. This number is only sales from the Manning website. Whatever Amazon have sold is not included. They haven't disclosed that figure to us yet. The book is at the press currently, and Manning have ordered about 4500 for the first print (hardcopies). So all together that is a good sign there is a strong interrest in Camel in the community.

That's it.

And if you wonder if the book is any good? Then this quote from the Camel father (James Strachan) says it all "I highlight recommend this book. It kicks ass!"

Wonder what would be my next project :)


Upcoming Webinar - Getting started with Camel and deployment options

FuseSource is hosting a live webinar on thursday the 16 th. December 2010.

This webinar describes the various deployment options for Apache Camel.

Learn how to easily use and leverage the power of Apache Camel and Enterprise Integration Patterns in a range of deployment options varying from plain java applications to full blown SOA implementations.

Designed from the ground up to be an easy-to-use integration framework, great value is provided to any developer with a need to integrate by providing a breath of connectivity options and implementations of the Enterprise Integration Patterns. By not relying on a heavy specification as starting point, Apache Camel has no dependency on a runtime container and has virtually endless deployment options.

Please join us for this free and interactive webinar that explores the deployment options of Apache Camel, whether you want to deploy with a messaging backbone such as FUSE Message Broker, a full ESB such as FUSE ESB or within your own plain Java or Java EE application this webinar covers the various deployment options available.

This webinar includes:
Apache Camel basics and deployment options
demo with code samples
interactive Q&A
how to use open source software to cut costs
how to get enterprise-class services and support

The presentation will introduce FUSE Mediation Router, a productized and fully supported distribution of Apache Camel that is designed for enterprise use. Be sure to join us for this informative and interesting session.

Date and time:
Thursday, December 16, 2010 5:00 pm
Europe Time (Amsterdam, GMT+01:00)

Thursday, December 16, 2010 8:00 am
Pacific Standard Time (San Francisco, GMT-08:00)

Thursday, December 16, 2010 5:00 pm
Europe Time (Paris, GMT+01:00)

Thursday, December 16, 2010 9:00 am
Mountain Standard Time (Denver, GMT-07:00)

Speaker: Scott Cranton

Duration: 1 hour

Use this link to read more and register if you want to attend the webinar.


Camel 2.6 - Improved management of custom processors and beans

I think its time for a non book related blog entry so here goes.

I have been having "fun" with the JMX API lately. I wont get into how utterly SUN managed to mess up from framework developer point of view. I am still puzzled why they didn't ship annotations in the JDK that allows you to decorate your beans for management. Just as the Spring guys already have done.

Anyway you may want to use custom business logic with Camel using a org.apache.camel.Processor or even better as a POJO.

Now in Camel 2.6 onwards the processors and beans which are defined in the Camel routes will now also be enlisted in JMX for management. By default they provide basic information, but you may want to expose some custom attributes and/or operations as well.

Now this is possible simply by decorated your processor/bean using the Spring JMX annotations. Camel detects the @ManagedResource annotation on takes it from there.

The only issue is that your custom processor/bean wont have the basic information that Camel usually provides, such as performance statistics. The reason is the aforementioned JMX API being a pain in the ****.

If you want to look for an example then I have updated this old FAQ entry about this new change.


Thoughts from the Devoxx 2010 Conference

I am sitting at the Brussels airport killing 1 hour before my flight back home. So I spend the time with Stella Artois and my laptop (without internet) which is a perfect opportunity for me to write a blog with some of my thoughts from the conference.

At the speakers dinner I had the pleasure of getting a ride with Stefan Janssen who is the organizer of the conference. On the ride was also Martin Dashorst and Guillaume La Forge.
Martin, Guillaume and I was also seater at the dinner and I enjoyed talking to them. It was great to hear from Guillaume that Groovy and Grails is moving forward very nicely. I have to say that when I first encountered the Groovy language about 4 years ago, I really liked it a lot. Likewise the Groovy in Action book is one of the best Manning book I have read.

Naturally we also talked about James Strachan, who was one of the founders of Groovy and is employed by FuseSource, and his recent statement about his new passion for Scala, and his works on Scalate.

It was nice talking to Martin Dashorst from the Wicket team. He is doing well as a consultant in Holland. In fact he is the boss for Phillip Luppens, whom I worked together with back on the WebWork days (the project which later was renamed to Struts2).

On wednesday I had the please to meet Phillip and Rainer Herams, whom are also from the WebWork team. They was so kind to invite me to the traditionally open source dinner that evening. At the dinner I meat other great people. For example Konstantin Pribluda who had developed a OCR recognition software on his android. It was completely client only which was impressive. For example you could use it to scan business cards and have it trained to detect the company name, personal name, email and so on.

I think its needless to say that we moved on to a cool bar which was in the basement, medieval style. We got a couple of rounds of beers, and mind this is the Belgian style beers, which tend to be stronger than the regular beers.

On thursday evening I was supposed to enjoy a quiet and relaxed dinner with the guys again, but unfortunately during the afternoon I started to fell that I could catch a cold. So I returned back to the hotel to catch some rest. In the evening I strolled in the Antwerpen centrum looking for some nice Belgian waffles. Back at the hotel I added some more slides to my presentation based on feedback I got from the people who visited us at the FuseSource boot at the exhibition hall at the conference. I rehearsed the presentation to make sure I got time left for QA at the end.

On friday morning I ran another rehearsal and went on my way to the conference. At the conference I meet up with my colleagues, Paul and Charles, from FuseSource who was so kind to drive here to hear my presentation.

Claus Ibsen speaking at Devoxx 2010

At 10:35 I got myself to the room 9 where the Apache Camel talk is taking place. I meet up with Martin Dashorst and he was so kind to help setup my mac laptop so it was ready for the presentation. Thanks a lot Martin. Loved that you got it working so I was able to see the next slide ahead on the laptop during the talk. I kinda like being able to start introducing the next slide before its displayed for the audience.

People keep coming in the room and it was almost full at 10:45 when we got started. I started well and the presentation was going well. Of course there was once a situation where my nerves was playing a trick on me. But that is expected during the first couple of minutes. Its after all the Devoxx conference where you are doing the presentation in a cinema with 400 people in the room.

The talk went really well, despite the fact there was a situation with the sound for some minutes. I finished the slides 8 minutes before the time was up. So we had a fairly bit of time for QA. And there was good questions from the audience.

I do hope the talk was inspiring and that people didn't fell it was one hour wasted. Well when I get back maybe some of the tweets will give me a clue if people liked the presentation.

I will post the slides at slideshare. You can get the presentation here.

The video recording of the talk will later be available from Parleys. Of course I will keep an eye when it will be there. However I don't know if my talk will be freely available, or its part of the Parleys subscription.

Well I am out of beer and this blog is over.

In the weekend I gotta work on my last revisions for the Camel book so we can do the 2nd edition of the type setting. The book will be in print in mid December. Just in time for christmas.


Devoxx here I come

This time I will attend the great conference Devoxx which is held in Antwerpen, Belgium. We at FuseSource sponsor the vent and we have a booth as well. So if you are attending the conference then please stop by and say hello.

I will be there for the full 3 day conference, as I am scheduled to speak on friday about ... yes Apache Camel.

As we are in Belgium there should be plenty of opportunities to have a talk over a beer. After all Belgium is known to have a great variety of beers. And as any other half wicket engineer I am listed on the javaholic page, so yes I love my coffee beans and beers.

Hope to see you there.


Route debugging in Camel 2.6 and other Camel news

I have previously blogged about some experiment we did on making route debugging easier in Camel.

We now the experiment is over and its included out of the box in Camel 2.6. I have updated the documentation as well. The documentation shows you that all you have to do is override a method in your test class. Set the breakpoint inside this method and you can now debug Camel routes easily.

There is a big mighty screenshot showing this in action at the documentation which is worth a thousand words.

Oh and the Camel community continues to kick ass. We got a new committer on board, Johan Edstrom. And Mark Ford contributed a JMX component. While Richard Kettelerij contributed a Spring Web Services component.


FuseSource has launched

A little late to the party, I got time to write a blog entry of this important event. The announcement actually happend on monday the 25th october 2010.

Rob has explained the background along with Larry's interview and Dana's podcast much better than I could have.

From a personal perspective I'm really excited about the future of FuseSource; we're growing fast, have some amazing customers & a great team including the folks who created Apache ActiveMQ, Apache Camel and Apache ServiceMix; and now we have autonomy so we can stay nimble & fast like a startup while we innovate and iterate to help our customers solve their integration problems with open source; all the while having the security of being backed by a large company. This is gonna be fun! :)


Camel in Action - One year anniversary

Exactly one year ago we announced the Camel in Action book and had it put out for pre-sale at Manning using their MEAP program.

Today the manuscript is complete and we are in the process of type setting the first chapters. So far chapter 1 and 2 has been type set. The other chapters will follow day by day.

I am currently battling with some minor updates for chapter 13 based on new features and improvements introduced in Apache Camel 2.5. Which btw is expected to be released in the near term. The release is to be cut this weekend.

Today I spoke with the publisher and they told me that so far the MEAP sales is at 1578. This is a great high number and gives a strong message to the community that there is a great interrest in Apache Camel. As you may know I have previously blogged that Camel in Action is a best seller already.

To celebrate this they gave us a discount coupon code you can use when ordering the book camel40au. Yes the code gives 40% discount.


Camel in Action - First typeset

The Camel in Action book is well underway. The first chapter has just been typeset and there are 5-6 other chapters in the pipeline as well.

Its in fact only chapter 13 which has to be updated on my end before its ready for type setting as well. And there are some chapters which are currently in proofing before they are ready for type setting.

Its hard to believe its just one year ago the book was put up for sale. Jonathan and I have been buys writers.


Paris and easier Camel route debugging

I am sitting at the airport in Paris killing a couple of hours before my flight home.
As usually the wifi is not free of charge, so I decide to save the 10 euro / hour and write a blog entry instead.

The Fuse Community Day in Paris was a great event. I enjoyed meeting with people who I have been working together with online, but haven't had the chance to meet yet.

I was told the audience liked my Camel presentation despite I had to give it in English. Most of the speakers spoke in French.

Nevertheless its really great to meet end users and hear about the troubles with Camel and what they like etc. I was talking to Christian Mueller from Atos Worldline and he would like to be able to easier debug Camel routes.

I totally agree and said we have introduced the Debugger SPI in Camel 2.5, which he could leverage. Albeit the API was geared towards tooling such as the FuseSource Rider that James Strachan is working on.

So the story is that here at the airport I have made it very easy when using the Camel Test Kit to debug Camel routes by leveraging the Debugger API.

Given this route:

        .transform(body().prepend("Hello "))

And having this unit test method:

    public void testRoute() throws Exception {
        // set mock expectations

        // send a message
        template.sendBody("direct:start", "World");

       // assert mocks

Its now possible to single step debug the route using by adding the following code, in the top of the test method:

    // you can debug camel routes easily as shown below:
    debug(new BreakpointSupport() {
        public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
            // this method is invoked before we are about to enter the given processor
            // from your Java editor you can just add a breakpoint in the code line below
            log.info("Before " + definition + " with body " + exchange.getIn().getBody());

For example if we run the test the code above will log each step as shown:
    [main] DebugJUnit4Test  INFO  Before To[mock:a] with body World
    [main] DebugJUnit4Test  INFO  Before Transform[{prepend(body, Hello )}] with body World
    [main] DebugJUnit4Test  INFO  Before To[mock:b] with body Hello World

So if you want to debug the route from your Java editor, all you have to do is to add a breakpoint in that code above and run in debug mode. Here is a screenshot from my editor showing this:

As you can see we hit the breakpoint in the Java editor and you can now inspect the Exchange.

The BreakpointSupport class has a number of methods you can override as callbacks at events.
- beforeProcess method is invoked before we enter a processor
- afterProcess method is invoked just after a processor

You can read more about this at the javadoc for the org.apache.camel.spi.Breakpoint interface.

I also though of instead beforeProcess and afterProcess as protected methods directly in the CamelTestSupport class allows you to easily debug by just overriding those method. Maybe we can have both solutions? I will start a discussion on the Camel mailing list about this.

Happy debugging!


Help us by taking the Camel Survey!

The Apache Camel PMC launched yesterday a survey intended to get a better understanding of how Camel is used, what the major issues are in getting started with Camel (and even for experienced users) and what improvements and new features you would like to see in the next releases.

The survey is anonymous and the results will be made public. Committers will use the survey results to help finalizing the 3.0 roadmap and prioritizing tasks. The Camel 3.0 release is planned for early Q1 2011.

So please take the survey (http://s.apache.org/camel-survey) if you didn't already!

Many thanks,
The Apache Camel PMC


Apache Camel - Proxy web service example

Well this was not planned at all that I would spend sunday morning working on an example for Apache Camel and also put on the load to write documentation for the example. I kinda did my shares of writing for last year ;)

Anyway we were discussing a web service proxy example for the FuseSource virtual training. As there are many ways to do this I wanted to contribute a little example to Apache as well.

In this example I chose to use the CXF component as the proxy front end in Camel. This allows end users to tap into the web service features from Apache CXF if needed. The communication with the real web service is pure HTTP based and therefore I simply use the Camel HTTP component for that.

To add a little more value to the example I added a step in the Camel route to use a Java Bean to validate and enrich the incoming request. For example suppose a client is sending illegal data to an existing web service and its too costly to fix that on the client. So by using Camel as a proxy, we can fix this, by patching the data.

The example will be part of the upcoming Apache Camel 2.5 release and the documentation is here.


Apache Camel - Webinars available on demand from FuseSource

If you missed our live webinar sessions covering Apache Camel, they are now available on demand at FuseSource.

The "Introduction to Apache Camel", is the webinar which I gave. We start from the beginning and talk when and why Apache Camel came to life. You will earn how Enterprise Integration Patterns fits in with Apache Camel. The major features and highlights of Camel is also covered. At the end I talk about the state of the open source community at Apache Camel and how well we are doing.

Jonathan Anstey did the part 2 of the webinar "Apache Camel Deployment Options", where he goes much more in depth covering some of the possible deployment options you have with the Camel. To go with that he shows live code from Eclipse for each option he covers. The downloads from this webinar contains the example source code which can be a good pillar for you to try out Camel and even use as skeleton for a project of yours.


First review of Camel in Action

Glen Mazza posted a review of the Camel in Action book on his blog, september, 2nd 2010.

The material is the latest MEAP edition of the book (the 8th update). Nevertheless the material contains all 14 chapters and in addition 3 appendixes. The final book will contain a few more appendixes and all the chapters will be revised to tighten up the language and improve the content. For example we will add more tips/hints for the new stuff we have since added into the Camel 2.5 release. We aim to cover Camel 2.5 with the book.

Manning is looking for people to review the final book, and if you are interested you can contact them by email at: mkt@manning.com


Camel 2.5 - Encrypting passwords for endpoint configurations

Dejan Bosanac co-author of ActiveMQ in Action, just recently added a new feature to Apache ActiveMQ to easily use encrypted passwords in the configuration files.

We have had such a feature on the radar for Camel for some time as well. So Ashwin Karpe and I discussed this a bit and we got started on it. As I have a weekend off writing on my book, I actually had the time to implement the most bits of this feature for Camel as well.

We use Jasypt, which is an easy to use encryption and decryption framework. This makes it fairly easy to implement with Camel, as all we had to do is to integrate it with the existing properties component in Camel, which allows the new camel-jasypt component to decrypt properties on-the-fly.

The documentation at Apache is already mostly updated so I refer you to go there and read more.

I am sure Ashwin and I will expand this feature a bit more and maybe introduce Jasypt as a Camel data format and/or a component. This allows you to use it for your messages as well.

This feature will be available in the upcoming Apache Camel 2.5, which is scheduled to be released later this month.


Camel webinars

FuseSource is giving two live webinars on Apache Camel in september:

  • Introduction to Camel, on September 8th
  • Deployment options for Camel, on September 16th

The speakers of those webinars will be Claus Ibsen and Jonathan Anstey, who happens both to be authors of the Camel in Action Book. So you get the information from the experts.

The webinars will be recorded and later posted on the FuseSource for anyone freely to download and listen. If you want to listen live and for example also be able to ask questions, then you can register here.


Basement Coders podcast on Apache Camel

As blogged by Jamie Goodyear, The The Basement Coders recently posted a podcast on Apache Camel. The talk is a pretty good introduction to the concepts behind Camel and is worth listening to if your just becoming familiar with the project. They also cover some of the reasons why it's a good idea to use Camel in Servicemix :)

You may want to skip to the 25 minute as that's where the talk about Camel starts.


Camel in Action - Is a bestseller

Manning recently published their bestsellers and Camel in Action made into the top 15.

Top 15 books year to date at manning.com based on combined ebook and pbook sales

  1. Spring in Action, Third Edition
  2. jQuery in Action, Second Edition
  3. Secrets of the JavaScript Ninja
  4. Lucene in Action, Second Edition
  5. Ext JS in Action
  6. C# in Depth, Second Edition
  7. The Joy of Clojure
  8. iPhone and iPad in Action
  9. iText in Action, Second Edition
  10. Camel in Action
  11. Clojure in Action
  12. ActiveMQ in Action
  13. Groovy in Action, Second Edition
  14. The Art of Unit Testing
  15. SQL Server MVP Deep Dives

This is fantastic news for the Camel community, showing there is a great interest in Camel. In fact it may seems like there are more demand for Camel than some of the other integration frameworks which have books as well. For example neither Mule in Action, nor Spring Integration in Action is listed as bestseller.

To celebrate this Manning is giving a 40% promoting discount. Through August 18, we invite you to enjoy any of these Manning bestsellers for 40% off the regular price. Just enter bestseller40 in the Promotional Code box when you check out at manning.com.

You can find the announcement from Manning here.


Meetup in Boston on August 17th

I will visit the states next week and will be in Boston for a FUSE gathering with my colleagues. On tuesday the 17th of August we will hang around the hip Indigo Lounge, where we can meet up for a chat and drinks. I am quoting the invite. Click the link to register yourself so we know you are coming and we can ensure we got free drinks waiting for you.

Register for a FUSE Meet UP with Apache Rock Stars

Did you know that several of the founders and committers of Apache ActiveMQ, ServiceMix, and Camel will be in Boston next week?

Join us for drinks and appetizers poolside at the hip Indigo Lounge on Tuesday evening, August 17th.

Get the latest news on Apache ServiceMix, ActiveMQ, CXF and Camel. Discuss how others are using open source integration software and get advice from top integration and messaging experts. Learn more about FUSE Forge and the Apache Software Foundation and how you can get more involved using and contributing to open source integration software.

Meet the FUSE Rock Stars in person.
  • Rob Davies: Co-founder of Apache ActiveMQ, ServiceMix and Camel.  Co-author of ActiveMQ in Action.
  • Stan Lewis: Committer on Apache Camel and open source expert on Apache projects
  • James Strachan: Co-founder of Apache ServiceMix, ActiveMQ and Camel 
  • Claus Ibsen: Top contributor to Apache Camel, co-author of Camel in Action 
  • Guillaume Nodet: Co-founder and top contributor to Apache ServiceMix, committer on Apache ActiveMQ, CXF, Camel , Geronimo, XBean, GShell, and ODE. 
  • Hiram Chirino: Co-founder of Apache ActiveMQ and Camel, top contributor to Apache ActiveMQ            
  • Chris Custine: Committer on Apache ServiceMix, Directory Server, and Felix
  • Hadrian Zbarcea: PMC Chair of Apache Camel

Meet and network with peers at this free meet up.
Register now.

Date: August 17th, 2010
Time: 4:00 PM to 7:00 PM
Location: Hotel Indigo Hotel, 399 Grove Street, Newton, MA 02462


Camel in Action - In production

Yesterday on July 16th 2010, Jonathan and I handed over the material for Camel in Action to production.

Just 30 minutes before the deadline I uploaded the latest revisions to chapter 10. I have been busy the last couple of days adding a new section about scalability. The section was a bit longer than I planned, but hey there is now almost 9 pages extra. So why did we do this? Well the reason is Apache Camel 2.4 has just been released and we decided to upgrade the book to fully cover this version. And the major new feature in 2.4 is the fully non blocking asynchronous routing engine, which means a great deal for scalability. Also there is minor updates to other chapters which covers the new features or improvements from 2.4. All together the book is up-to-date and covers the latest release of Camel.

The source code for the book has been upgraded, and it was even used to help test the 2.4 release candidate.

We will publish a MEAP update next week. And speaking of MEAPs. Manning told us that the book has been really well received and we have so far sold 1142 copies (MEAP only). So if you are using Camel, then you are definitely not alone out there.

So this weekend may actually be one of the few weekends where I will not work on the book? Well guess wrong, there is still material to write such as: Two additional appendixes, front matter and part openers. So Jonathan and I will still be busy writing. And did I mention that the production phase means Jonathan and I am going to revise each chapter at least three times. There are professional tech- and copy editors and graphic artists assigned. They make a tremendous improvement and the material is so much more enjoyable to read when they have had a go at it.

If you are interested in the book, then head to the fusesource website where we have a exclusive discount code and excerpts from the book as well.


Exclusive excerpts and 40% discount code for Camel/ActiveMQ in Action books

It's just by coincidence that both the Camel in Action and ActiveMQ in Action books are entering the production phase. This means the material for the chapters have been handed over for production.

In this regard fusesource have exclusive excerpts available for free (no registration required):
- Chapter 9: Learn about using transactions with Camel
- Chapter 5: Learn how messages are stored in AMQ on KahaDB

If you are in the lookup to buy either or both books then stop by the fusesource site to find the 40% discount code you can use when ordering from the Manning web store.

If you want to know more about transactions with Camel then fusesource also have a free guide on this matter, which you can find here.


Impressions from the London Fuse Community Day

I am waiting at the airport for my flight back home. I have about 1 hour to kill and might as well seise the moment and write a blog entry about my impressions from the fuse community day we held here in London.

At first I have to say that I must have picked a really bad spot at the airport, the Bridge Bar - terminal 3.
I have never had such a terrible old fashioned burger with crisps before. After a night out with beers and drinks, I am really not that picky about food the day after. Food like you would categorize as junk food suits in fact well. I immediately had a bad feeling when I had to order at the bar and barely got back to my seat before the waiter arrived with my meal. This is one of the first times I have to just eat less than 25% of the meal before giving up.

Back to the community day. Before arriving to the sense at the Skills Matter Exchange office, I had an impression it would be a regular and a bit fancy office. But it turned out to be a really rustic area which reminded me of a garage or warehouse which has been painted up a bit and installed a kitchen. The area was perfect for such a event as the FUSE community days, as we really want to make it a informal event where we have a line of mixed speakers and that you get the chance to network and chat with others over coffee and beers. I personally enjoyed listening to others about the business planes, ideas and integration challenges they are facing.

I was the first speaker on the stand and I was given in addition 20 minutes so this time my presentation had additional slides and more time to go more deep than the event in Germany.
We had a brief hands up in terms of who was using Camel and there was not full hands, so this was a great chance for me to enlighten people what Camel is and what it may be able to help you with. After the presentation there was great questions from the audience and with the help of James Strachan we managed to give back great answers.

I was impressed by James Casey who presented a talk about how CERN uses FUSE as a messaging backbone in their IT portfolio. Dan Salt presented a very interesting talk about some of the mornings challenges in the energy section having the need for a "smart grid".

In between Adrian Trenaman from Progress, gave a talk about scaling up Apache ServiceMix, which was a perfect follow up on my Camel talk, as people are interesting to know how to run their Camel applications in a clustered environment, which ServiceMix 4 fit in well.

Debbie Moynihan from FUSE marketing was also present, and she had audio and video equipment with her, so all the talks was recorded. She said she will have the recordings processed and post it on the FUSE website.

I was told that they are planning a new FUSE community day in Paris after the holidays. And that London and Frankfurt is on the radar next year as well. So if Camel is still interesting these times around, then I may be able to attend and give a talk. Regardless of what the days is a really cozy and relaxed day. I wish back in my previous days that such kind of events was more around. Much easier to convince your boss to take a day out of the office, when everything is free.


Camel in Action - In final review

I better write this blog entry today, the 4th of June 2010. Its exactly 11 months since I started writing for real on the Camel in Action book (July 4th 2009). So today Jonathan and I have completed the 14 chapters for the book, which means we enter a new phase - the final review.

What happens now is the material will be send out to a group of people who return feedback. In the mean time, we the authors, will start working on other aspects to complete the book, such as indexing, adding last minute minor changes and updates, overhaul all the summaries, polish the figures etc. The feedback comes back and we incorporate the changes needed. Then the next milestone is going into the production phase. This is the phase where we have professional copy editors and tech reviewers assigned to help go through each and every chapter 3 more times - line by line, word by word. And on top of that a professional graphical artist helps ensure the figures is sharp and crystal.

In additional the appendixes, the front matter, and the forewords have to be written and added. And from a marketing standpoint the description of the book, author bios etc. must be updated and distributed to the various book sites. And much else I have forgot and at this time of writing is unaware of.

So there is plenty of work to do. In fact the publisher told us, that from now on, the work load would be more intense because of more aggressive deadlines and being able to react quicker as more people is involved now.

All together the book will come out of print in fall 2010, I was told October is a likely month.

But one thing which cannot interfere is me having beers and following the world cup. Even though Denmark is most likely to fall short and not make so far.

And yes a new MEAP will be published as well. I expect Manning to do this sometime next week, while I am visiting London for the FUSE community day.

PS: If you think you have the time and interest in being part of the final review. Then let me know so I can get the publisher to contact you about this.


I am going to London for the free FUSE community day

I am attending the 2nd FUSE community day this year. This time its happening in London.

And I am giving the honor to be the first speaker, as I was in Germany, but this time I am given additional 30 minutes. So either people in UK are a bit slow compared to the people from the continental Europe, or its just the fact that there is love for Camel and people want to hear more. 

I will speak about Apache Camel at the FUSE community day (its free to attend), which is held on June 10th 2010 in London.  We start at 9:00 am having a reception and the talks will start 1 hour later. We have a full packed day planned with great speakers.

At 4:30 pm its time for "evaluation" where you can join us for a drink and chat with the many great minds at FUSE and network/mingle with the other participants. This is most like the best event as you will get free drinks and talk with others who may face the same daily challenges as you. And the world cup is starting the next day so we can always fallback and talk about footie.

You can see the agenda which is listed on the FUSE Site.

10th of June

9:00AM to 4:30PM

Skills Matter eXchange, 116-120 Goswell Road, London

Who Should Attend
Developers, architects, engineers and IT managers

How to register
Use this link.


Apache Camel and BPEL

As one of the founders of Apache Camel, James Strachan announced last year, we will switch the Camel routing engine to be 100% BPEL based. BPEL have just proven to be superior as it locks down the number of choices and freedom you may otherwise have with Camel. And on top of that you can tell management and decision makers that Camel is standardized on one of the few acronyms they may have heard about.

With this decision in mind, Jonathan and I have decided to scratch the Camel in Action book and start all over again and have it titled BPEL in Action. Existing MEAP subscribers is asked kindly to delete their received pdf files and patiently wait 2 years for us to re-write the 14 chapters.

Okay its not the 1st of April, but this is of course not going to happen. However there is a slight grain of truth in there. There has been people in the Camel community who have been asked about native PBEL support in Camel. So with that in mind we have started a camel-ode component, which leverages the Apache ODE BPEL framework. The source code is in trunk and you are more than welcome to help out of you are interested. The code is currently a prototype and it definitly need some more love to turn it into a beautitful Camel component. I am personally way to deep into the Camel book to be able to spend my spare time on finishing the camel-ode component. So please help us out. Maybe your organization already uses BPEL and thus would be much interested to have it supported out of the box in Camel. 

If you can't wait for BPEL in Camel then FUSE ESB 4.2 now provides PBEL support. 


Apache Camel 2.3 - How to ignore exceptions

Error handling is notoriously hard and Camel have extensive support to configure and handle situations differently when a failure occur.

One such feature is the onException which allows you among others to define policies what to do when a given set of exception occurs. For example you can define individual redelivery settings, to say that ConnectionException should try up till 5 times with a backoff multiplier of 2.

In cases where we give up (exhaust) you can let Camel route the messages which allows you to do some custom processing when we failed. In these situations you can also indicate you want to handle the exception. That means the exception is removed from the Exchange and you can provide a custom failure message, to a waiting caller. For example if you do request/reply over TCP where you need to return a custom format in case of failure.

But there are situations where you just want to ignore and continue if a given exception was thrown. And up till now that was only possible to do using the doTry .. doCatch in Camel. However in Camel 2.3 we now have a new option on onException called continued, which allows you to tell Camel, that it should ignore the exception and just continue routing to the next processor in the route.

We picked the name continued because the similar option was named handled. And when using continued its automatic handled as well. And you can only configure one of them.

You can read more about this at the Camel wiki page, at the section Handle and continue exceptions.

Another feature which I have meant to write about for some time is the Event Notifer, which allows you to subscribe to events in Camel. For example you can be notifier about routes being started and stopped etc. Also fine grained events about Exchanges being routed as well. For example when an Exchange is being sent to an endpoint. Suppose we want to log all those events and how long time it took to sent it to the endpoints. I have created an example in the cookbook page at Camel. You can find it here.

PS: If you do not grasp the Camel error handling, then the chapter 5 in the Camel in Action book has received great reviews and people generally understand the error handling much better after reading it.


FUSE community day - Here I come

I am proud to announce that I am attending the next FUSE community day as a speaker.

I will speak about Apache Camel at the FUSE community day, which is held on May 25th 2010 in Frankfurt, Germany. We start at 9:00 am and have a full packed day with great speakers.
At 4:30 pm its time for "evaluation" where you can join us for a drink and a "one-on-one" chat with the many great minds at FUSE and network/mingle with the other participants.

You can see the agenda which is listed on the FUSE site.
Get the latest news on Apache ServiceMix, ActiveMQ, CXF, Camel.
Hear from committers, founders like Rob Davies, James Strachan and Claus Ibsen and users who have successfully implemented Apache in projects.
Meet and network with peers at this free educational community day.

25th of May

9:00AM to 4:30PM

Radisson Blu Hotel, Franklinstrasse 65, 60486 Frankfurt am Main

Who Should Attend
Developers, architects, engineers and IT managers

How to register
Use this link


Camel in Action - Going well, a glimpse of light ahead

Over a year ago we did start on what seems inevitable - A demand in the market for an Apache Camel book.

Looking back in my mail archives, the first trace I can find about how all this began was dating back to February 2009. It was just a month after Apache Camel became a Top Level Project at Apache (actually long overdue).

Now fast forwarding to today, April 25th 2010, its with pride that we can say the book project is definitely going well. The book was launched to the public in late October 2009, and now 6 months later we have a steady and stable stream of book updates (MEAP). In fact the book has been updated 5 times (incl. the first). This is strong testimony that we are on a good path towards the goal of having the book published in Q3 2010. Also we are very proud begin able to offer frequent MEAP updates which ensures, you the readers, having a good feeling as well. I know as a MEAP subscriber myself it becomes frustrating when there are no updates for a long time, and the authors of the book, is not responsive on the Author forums as well. With the Camel book you will neither find yourself in such a situation.

Also we make an effort to make every page of the book count with quality - you'll not find full pages with a maven dependency dump or a console dump of Tomcat starting, etc.. Having seen this in other books, you can't keep wondering that the writers was a bit lazy here, and that you would rather have had those dumps being cut; giving leg room for more pages with material that enlightens you.

At this time we had our 3rd review by a selected review panel. The panel takes their time to read and review the material and provide critique and excellent feedback. Without the guidance and help from this panel, the book would not be in such a great shape, it is currently. The panel is also reassuring we are on the right path as the overall impression on the material is getting much better. They are rating the current material in top (4 or 5 out of 5).

Today is sunday and yet another weekend I will spend writing on the book. Jonathan is busy on chapter 12 and I am hacking on chapter 8. That means the next MEAP update would at least contain 2 new chapters. After this there is only chapter 14 left. And then there is much more work as well, refining each and every chapter, having them copy edited (multiple times), reviews, indexing, appendixes, forewords, double checking code listings, etc. etc.

But still we can start to see the light at the end of the tunnel.


Apache Camel 2.3 will be yet another big win for the Camel community

When I glace over the progress of the Camel 2.3 on the in progress release notes, it tell me this is going to be a yet another great release. The Camel community is really stepping up and keep contributing to the Camel eco system. This time we are looking at approximately 10 new components, this may be a record high.

Martin Krasser keeps working on new features and components to the Camel Google App Engine, as well as his great work on the Camel Akka integration.

And this time we had a new component to the camel-core, which doesn't happen that often. Its the property placeholder component, which finally allows you to use placeholders in your Camel routes without having to use Spring Property Placeholder workarounds and whatnot.

We are also bringing in HawtDB which I am sure we will expand in the future. Currently its the persistent framework for the overhauled aggregator, so we can have those in flight aggregated messages in a safe persistent store.

Ashwin Karpe took the time to add camel-netty, which is great news for us that are starting to loose faith that Apache Mina 2.0 is ever going GA. When I got started with Camel, Mina 2.0 was in the works, and that is over 2 years ago.

Christian Mueller did really great and hard work to upgrade both camel-jetty and camel-http to use the latest stable releases of Jetty 7.0 and Apache Http Client 4.0.1. However in the latter case, we have recently decided to keep camel-http using the good old trusty Http Client 3.1, and let camel-http4 be the new playground for the Http Client 4.x, while it matures a bit more.

Christian didn't stop there and is now working on a camel JSR-303 component for bean validation, CAMEL-2565, which should make it in Camel 2.3 GA.

Mitko Kolev created a camel-exec component, so we can execute native applications. The component can then capture outputs from std out, err and whatnot. Really great work.

Christian Schneider created a camel-soap data format which allows you to marshal to/from SOAP without the need to bring in the guns with CXF or similar framework.

Stephen Gargan, contributed the camel-crypto component/data format. Now using javax.crypt has never been easier in Camel.

And the Camel itself, had many other significant wins as well, which I will safe for another time to do a blog entry.

And yes we need to have a couple of these new components documented on the wiki. It would be a shame if we have to pull out a new component from the release, just because, the contributed only contributed the code, but didn't do the necessary documentation as well.

As you know I have writing Camel up to both my ears with the book, so it must be the community who documents, what is contributed to the code base.

This is really outstanding work from the Camel community. A round of applause from your humble Camel rider.


Deal of the Day - ActiveMQ and Camel in action - 2 for 1

Manning have a deal of the day today, which means you can buy both ActiveMQ in Action and Camel in Action for the price of one. The deal is for all both print, ebook or print + ebook.

Use coupon code DOTD0401
As its a deal of the day its only valid the 1st of April 2010.

A new MEAP update of Camel in Action should be out shortly, which should include 3 new chapters. 


Camel meets Elvis

Last weekend, I was supposed to write on chapter 10 for the Camel in Action book, but I got side tracked with the prospect of Camel meeting Elvis.

A FUSE customer is in due time to upgrade to from Apache Camel 1.x to 2.x and they are currently using the Spring XML to define routes. They are using the Content Based Router EIP with predicates. As Camel 1.x is not as rich in its Spring XML they had to write those predicates in Java code. In Camel 2.x the Camel EL, known as the Simple language, can be used for most common use case for defining predicates.
However they are using predicates which accessing a header which is a Map value, which they then index. This is currently not possible to do with Apache Camel 2.2, as the simple language can only, retrieve the header value.

In this light we could easily add special support for using a syntax like this: header.name[key] to support their use case. This was easy to implement, in a matter of minutes, ah okay, lets say 1 hour at most.

However then it occurred to me as I have previously thought of adding a OGNL to the Camel Simple language. Its not a full blown OGNL like: Mvel, OGNL or the dynamic programming languages: Groovy, JuEL, JavaScript etc. But still a simple OGNL that will raise the bar that the Camel EL can solve out of the box, from 80% to 95% :).

So in the weekend, my wife had other plans, leaving me with plenty of time to give it a go. After having implemented a fair bit of the OGNL so you can invoke methods, access Map/List etc. it occurred to me that Camel must meet Elvis.

Its of course not the king himself, but the mr Elvis Operator. Which means you can do ?. in the OGNL notation.

Suppose you have a User object on a Message and want to test whether an address has a zip code in a certain range.

For example you can do:
  ${body?.address?.zip} between 5000..5999

Notice how we can use the elvis operator to avoid the NPE. If the User object do not have an address the predicate will return false.

I have updated the Camel Simple wiki page with a few more examples, if you want to learn more.
And btw the Bean language also supports this new OGNL.

I have though of adding it to the Bean component as well, so you can do in an endpoint

But currently it cannot do this. Any thoughts?
This new feature will be available in Apache Camel 2.3.

PS: I have started on chapter 10


Apache Camel 2.3 - Overhauled Aggregator and introducing HawtDB

For the last couple of weeks I had the time to work on recoding the Aggregator EIP in Apache Camel.
Over the time we have gathered a list of issues with the old code, which you can find here.

The works is now complete and we got a much improved Aggregator in Apache Camel 2.3 onwards.

The new and improved aggregator
First of all it allows you to use multiple and independent ways of triggering a completion. For example you can say the say the completion should happen when 5 messages have been aggregated. Then that will wait until that condition occurs. So if that takes 4 seconds or 17 hours don't matter. You may also add an additional completion trigger such as an inactivity timeout. So if you think that waiting 17 hours is to long you can set the timeout to e.g 1h. The aggregated message will also contain a property which tells you which of the completion conditions triggered. So you can see if it was the timeout or the size etc.

On top of that the inactivity timeout is per correlation key. So if you aggregated with multiple keys then those are separated. In the old logic, the timeout was not based on inactivity, but really just a timer for a background thread to wake up, and start aggregating the messages which have arrived since last time.

This is really a great improvement as it works much more in the way end users will expect, that the timeout is based on inactivity and its per correlation key. So for example the timeout is not reset just because a new messages arrived on a another correlation key.

You can also add a 3rd completion trigger such a predicate. So you can use that to check if a special message arrived, or the aggregated message contains some special data that would trigger completion.

On top of that we have added support for letting the aggregator use parallel processing. That means you can have concurrent messages being send out of the aggregator.

And another easy of use change is that the AggregationStrategy is now mandatory, which means than the UseLastAggregationStrategy is no longer default. That should fix up some confusing when using it for the first time - e.g. why does the aggregator just spit out the last message, etc.

Other minor improvements is that you can chose what to happen if the correlation key is bad, and as well you can now "close" a correlation key to deny late messages.

Introducing HawtDB
Well that is not all, this blog entry is also about a new feature which I am a bit exited about.
With the help from the very talented people from ApacheMQ, such as Hiram Chirino, we have a new Camel component, called camel-hawtdb.

HawtDB is a lightweight and very fast key/value database. Its based on the sound knowledge from ApacheMQand its KahaDB persistent store.

So what we have done now is to integrate HawtDB with the Camel aggregator. Which means we now support persistence out of the box. That means the aggregated messages is persistent to a file store, which means you avoid loosing messages in case your server crashes, or is reliable shutdown.

This is just a start. We will in the future add support for using HawtDB in other areas with Camel, such as the resequencer EIP, SEDA queues, DeadLetterChannel, StreamCaching big streams, idempotent repository and elsewhere. If you got good ideas for use cases then let us know.

I have put together a small example which demonstrates the new aggregator and the persistence support. If you don't want to run the example, the link showed console output which is kinda like the sexiest we can do with integration software.


Apache Camel 2.2 Released

After a bit over two months of hard work we are pleased to introduce the Apache Camel 2.2.0 Release.

This is another major effort featuring 181 issues resolved. The Camel community is growing at a faster pace and we see a lot of involvement and contributions.

The feature and improvements list is too large to fit here, so please check out the release notes.

Most notable changes are:

  • Graceful Shutdown which ensures a more reliable shutdown of Camel
  • File component now delete orphaned lock files on startup to remedy situions where Camel was abruptly killed
  • Improved error message on startup in case where Camel routes are misconfigured
  • Improved logging of exceptions being thrown, which now is logged by default at ERROR level
  • Fixed issue with using Camel annotations on beans proxied with CGLIB such as when using Hibernate or Spring AOP
  • Improvements to Aggregator, Routing Slip, Recipient List and Multicast
  • Reduced the optional dependencies on Spring jars
  • Added new log in the DSL for logging dynamic human readable messages (think like doing System.out.println)
  • Introduced NotifyBuilder which helps during testing. For example when testing routes without mocks etc. It will help to notify when a certain condition has occurred such as X messages is done etc.

And a bunch of new components contributed by the community such as

  • camel-jboss for running Camel inside JBoss Application Server which uses it specialized classloading which prevents typically frameworks to not work out of the box inside JBoss.
  • FTP Now supports FTPS (FTP over SSL/TLS)
  • SMPP To send and receive SMS using Short Messaging Service Center using the JSMPP library
  • Lucene Uses Apache Lucene to perform Java-based indexing and full text based searches using advanced analysis/tokenization capabilities
  • HDFS For reading/writing from/to an HDFS filesystem

As usual, a lot of fixes and enhancement of the 90+ Components

Many thanks and our gratitude to all the contributors who made this release possible. Download Camel now and enjoy the ride!

Work on the next Apache Camel 2.3 is already underway. This time I finally got time to overhaul the aggregator EIP in Camel which has been on the roadmap since the 2.1 release. I can already reveal the overhaul requires changes which are not backwards compatible. However its mostly options which have been renamed or removed. So the migration effort should be minimal.


Property placeholder galore in Apache Camel 2.3

We are close to two year anniversary of SPR-4466 with no sign of willingness from Springsource to open up Spring Framework allowing 3rd party frameworks, such as Apache Camel, to leverage their property placeholder feature to the fullest.

The RFE was filled 2 years ago by James Strachan, who is well known in the OS community, but still Spring has just kept postponing the ticket. At first it was scheduled for Spring 3.0, then in december 2009 it was moved to Spring 3.1. I bet its just a sign that the RFE did not fill out a gap that the other spring products needed.

Well we can't wait for Spring forever so this last weekend the Camel team developed a new property placeholder feature which will be part of Camel 2.3. Looking back we should have done that for the Camel 2.0 release but we was waiting for it to provided in Spring 3.0.

Well its not bad either because the property placeholders provided with Camel is implemented in camel-core which means you can use it without using Spring at all :) Its also build in the Camel simple language and the endpoints is resolved at runtime which means you can also use it for ProducerTemplate etc. Basically they work everywhere where you can enter a endpoint URI. So we got them all over, its mayhem, its galore :).

I have already written documented at the Apache site how to use it so I will just be lazy on this blog and refer to its documentation.

Okay if you use Spring XML we have created a nice XML tag for it as shown below:

  <propertyPlaceholder id="properties"

And the below is part from a little route in Java DSL using placeholders. Notice the #{ } syntax. Yes it works from Spring XML as well.
// properties


// route


Camel in Action - Half way through

I thought it would be a good moment to sit down and write a little blog entry about how it goes with the Camel in Action book. What better moment to do that than sitting in Heathrow killing a couple of hours before before departing to the states for a business trip. I am exited as I get the chance to meet my fellow and talented co worker from the Fuse team.

It has been almost 7 months for me on the book in terms of writing. I started at full speed on the 4th of July which must be a date that our friends from the states can remember. A couple of months in the process Hadrian and I realized that we need to adjust the team. We invited Jonathan to join us which works great. He have already produced 2 full chapters and is up to speed on the third. This is impressive as he got the honor to rewrite the first chapter which is the hardest to write. All three of us have had a go at this chapter.

In terms on my end I have focused on some of the more technical heavier chapters which suits me fine. It's after all me who is responsible for some of the major overhaul, improvements and new features introduced in Camel 2.x. Yes I am sure to brain dump evert piece of information so you are sure to get the most up to date material in the book. For example I have amended the chapters several times during work on Camel 2.2 which have introduced some new features and improvements.

Two weeks ago we had our 2nd review completed. The review process is controlled by Manning and they do a great job finding a great bunch of people for the review panel. Its totally anonymous so we do get the word from the hearts. It's a mixed group of Camel experts, end users and authors whom have don't know Camel. I will get to what this 2nd review have had as impact on the book in a moment later.

We have also started the first copy editing process which means a professional editor from Manning is going over each and every chapter word by word, line by line, and checking that all add up. This is a remarkable work they do. We could start this work already since the 2 reviews have shown us that we are on the right track and the content so far in the book is great. Readers of my chapters will be glad to know that after the work of the copy editing the grammar and the flow in the language will be enjoyable to read. I am sorry but english is only my 2nd language.

Another impact the review and also you the readers of the book have had is that we have been in talks with Manning to extend the book with 2 new chapters. This is possible to do since the book have been received well so far. Thanks for all of you who have shown interest in the book. And especially you who have bought it. Its all thanks to you that we can include 2 new chapters to make the book cover Camel really really well.

We have already devoted one of the new chapters to cover concurrency, threading and the stuff associated with this. Its my next chapter when I have finished what is to become chapter 12 (monitoring and management).

As there are still one chapter to be decided what it should cover we have though to ask you. Of course we do have a couple of topics in mind but we would rather leave it totally open. So please if you have ideas then come along the Manning Author Online forum where we can discuss this.

At current time we have produced 7 chapters in a total of 250 pages which is available at the Manning MEAP program. That must be the half of 14 chapters, hence the block title.

Claus Ibsen
Heathrow, Terminal 5, B gates


Apache Camel in the cloud (GAE)

Martin Krasser our new and talented committer have crafted the camel-gae component with a very cool tutorial and demo application as well.

Now you can try this out as the Camel tutorial demo application is running in the cloud at Google.
You can get to the demo from this link: http://camelcloud.appspot.com

You can read more about the tutorial here (has screenshots).


Apache Camel 2.2 - Improved Test Kit

In this blog post I want to announce two new features in the Camel Test Kit which makes unit testing Camel routes easier. They are geared towards unit testing existing Camel routes where you may not use mocks or the likes. In other words testing production like routes.

The two features are:

This blog post will cover the latter of the two. The reason is that I have yet to create wiki documentation for the former. So many things to do :)

NotifierBuilder is as its name implies a builder which allows you to build an expression about a future condition where you want to be notified. Suppose you are doing integration testing and want to test when using a client API to send message, that those messages have been received and are routed as expected. Since we use a client API its not a Camel API which sends the message. Which means we have less control of this. And as we do not have mocks in the route we cannot easily know when or how the messages was routed. The NotifierBuilder helps you with this. Basically you build an expression which tells you, when this endpoint have received 3 messages and that endpoint have processed this special message then ring the bell.

A basic example
Lets start with a very basic example which just rings when one message has been processed.

NotifierBuilder notifier = new NotifierBuilder().whenDone(1).create();


boolean done = notifier.matches(10, TimeUnit.SECONDS);
assertTrue("Should process the message within 10 seconds", done);

As you can see from this basic example, we created a notifier with the expression whenDone(1) which means that when 1 message has been processed. Then we use the client to send the messages or what ever it do to get the ball rolling. The point is that it may not be the Camel API sending in those messages.

Then we want to wait for the bell to ring, which we use the matches method on the notifier. To not wait forever we can pass in a timeout, which in this case is 10 seconds. Then we assert that a message was processed. Now we can do additional testing to verify the message was processed as expected. For example checking a database if the message was supposed to update something in it etc.

You are allows to invoke the matches method on the notifier as many times you want. So you can also use it to test that it should not match etc.

Another example
This is just a quick example to show the builder in action as it has many more methods to offer.

NotifierBuilder notifier = new NotifierBuilder()

As you can see the builder allows you to stack expressions together which in this case we got 3 of them.

Combing the power with the Mock
You can even combine it with the power from the Camel Mock component, which allows you to use mocks for fine grained expectations. For example we expect those 3 messages to arrive in any order coming in on any JMS endpoint. 

MockEndpoint mock = getMockEndpoint("mock:foo");
mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Hi World");

NotifierBuilder notifier = new NotifierBuilder(context)

To do this we can use the Mock for the fine grained expectations. The mock:foo is just a pseudo name as the route does not have any mocks for real. So you can give it any name you like. Notice how we use wildcard matching on the from to match any kind of JMS endpoint. Its the same wildcard matching as with the interceptors so you can use reg exp as well.

Want to learn more
You can read more about the NotifierBuilder and see which methods it currently offers at in the documentation. You can read in general about testing with Camel here.

And I also have to stress that chapter 6 in the Camel in Action book is devoted to the art of testing with Camel. So you got 35 good pages on this subject.

As its a new feature introduced in Camel 2.2 then we would of course improved it over time. And if you have ideas or feel a method in the builder is missing then let us know. And as always we love contributions and patches. And as always naming is hard, if you have better ideas for method names on the builder then again feedback is welcome.

Oh and the adviceWith is also a promising feature which I later will get documented as well. As always you can check out the source code to learn more :)

Update: NotifierBuilder has been renamed to NotifyBuilder. Which means the updated link to the documentation will be http://camel.apache.org/notifybuilder.html when the Apache wiki is synched.