Review: Apache Camel Developer’s Cookbook

A week or so ago, the nice people at Packt Publishing offered me a chance to review “Apache Camel Developer’s Cookbook” I’m always happy to read another book on my favourite integration pattern (and get a free ebook 🙂 as you always learn something new. I’m also glad to report that this is a fine effort by Scott Cranton (@scottcranton) and Jakub Korub (@jakekorab) and well worth getting to go alongside the canonical “Camel in Action” by Claus Ibsen (@davsclaus).

Where CiA dives deep into the guts of Camel, ACDC is presented as a recipe book. You can read it section by section, starting with the basics of routes and endpoints, and moving on through various message patterns to security, testing and performance.  or, you can drop in to the section you want, to pick out a given recipe, as long as you have some Camel already under your belt.

It was heartening to see most of the recipes described not only using the Java DSL, but also in Spring XML. It might be more verbose, but it made it a lot easier to read for people like myself coming from the XML document side with only a smattering of Java and using Camel more as a tool.

Each recipe, is arranged identically:

  • The goal of the recipe is described.
  • Getting Ready. Prerequisites and how to set up the example code.
  • How to do it. Detailed steps for the recipe.
  • How it works. The background/architecture description in Camel.
  • There’s more. Further steps/more advanced use.
  • See also. Links to resources.

It’s a neat layout that reads easily, with only a couple of places where the material felt a little coerced, and each recipe is backed up with code ready to run via a ‘drop-in’ maven project.

The recipes are grouped into themed chapters:

  1. Structuring Routes.
  2. Message Routing.
  3. Routing to your code.
  4. Transformation
  5. Splitting and Aggregating
  6. Parallel Processing
  7. Error Handling and Compensation
  8. Transactions and Idempotency
  9. Testing
  10. Monitoring and Debugging
  11. Security
  12. Web Services

These were all informative, and showcase how a wide variety of problems can be addressed in Camel with some background on the EIP message patterns they represent. The chapters on error handling, testing and monitoring are excellent and provided a practical balance while the chapter on Parallel Processing addresses some of the issues of scale. If I had a complaint, and it’s probably just my take on Camel use, it would be that some of the recipes went straight for the more complex offering, e.g Bindy for CSV handling rather than starting with a data handler and a POJO.  It shows that Camel is ready for the big time, and it is, but I think it obscures the great flexibility of Camel as a framework for not only complex problems but doing, perhaps simpler or mundane, things really well.

All in all it’s a good, informative book. If you’ve used Camel before there’ll be a few things you haven’t seen and some good examples of best practise. If you haven’t, it’s got a good mixture of background and drop-in code to get you started.