I am pleased to finally announce the reason that I have fallen off the face of the Earth over the past year – myself and Scott Cranton have just finished writing the Apache Camel Developer’s Cookbook. The book will be published by Packt Publishing later this month. It is available for pre-order on the Packt website, and also on Amazon (where it’s currently listed by its working title – Camel Enterprise Integration Cookbook). After 12 months of hard work and late nights (as well as early mornings) at home, in planes, trains, automobiles, hotel rooms, and airport lounges we’re very excited. And relieved – it has been a huge job writing about the ins-and-outs of this incredibly rich integration toolset.
Our intention when writing the book was to develop something that complemented Claus Ibsen’s and Jon Anstey’s awesome Camel in Action. After 3 years Camel in Action continues to be an outstanding reference and a great text for learning Apache Camel inside-out, and has aged incredibly well – a testament to Camel’s solid underlying design. One of the comments that we heard frequently when out on site with clients was that they had bought it, and were going to get around to reading it… eventually.
Our main driver, therefore, was to write a book for the busy system integration developer who just needed to Get Stuff Done. All without requiring them to read a whole book and learn the entire framework, while at the same time not glossing over any of the key issues that they needed to consider in order to build a complete production-ready integration with Apache Camel – you know, with good performance, error handling, transactions etc. The result is a book with over 100 how-to recipes, each written in both of Camel’s Java and XML DSL variants, put together in such a way that people can jump around and get just the info that they need in order to get the job done.
There is a lot of good content there across all difficulty levels. Developers new to Apache Camel will find useful information on how to set up Camel in both regular Java and Spring-based applications, through to the ins-and-outs of the various Enterprise Integration Patterns (EIPs) (how they are affected by multithreading, transactions etc.), payload transformations and testing. There is plenty of good stuff for experienced developers too as we work through parallel and asynchronous processing, error handling and compensation, transactions and idempotency, monitoring and debugging, as well as detailing Camel’s support for security – your company encrypts all traffic, right? No? Well, no more excuses.
The chapters cover:
- Structuring routes – everything from how to integrate the framework through to route templating
- Message routing – a coverage of the main routing patterns
- Routing to your code – how Camel interacts with your Java Code (bean binding, processors etc.)
- Transformation – moving between XML, JSON, CSVs etc.
- Splitting and Aggregating – a deep dive into the related Splitter and Aggregator EIPs
- Parallel Processing – outlines Camel’s support for scaling out processing
- Error Handling and Compensation – dealing with failure, including capabilities for triggering compensating logic
- Transactions and Idempotency – how to handle failure of transactional (JDBC, JMS) and non-transactional (web services) resources
- Testing – how to verify your routes’ behavior without the need for backend systems
- Monitoring and Debugging – describes Camel’s support for logging, tracing, and debugging
- Security – encrypting communication between systems, hiding sensitive configuration information, non-repudiation using certificates, and applying authentication and authorization to your routes
- Web Services – a deep dive into working with one of Camel’s main use cases: SOAP web services
Some of the juicier recipes include:
- Working with asynchronous APIs
- Defining completion actions dynamically
- Testing routes with fixed endpoints using conditional events
- Digitally signing and verifying messages
- Enabling step-by-step tracing in code
- Monitoring other systems using the Camel JMX Component
- Idempotency inside transactions
- Setting up XA transactions over multiple transactional resources (many thanks to the guys at Atomikos for their help on this one)
The book is right up to date, with coverage of Camel 2.12.2 and a bit of eye candy thrown in for the monitoring chapter thanks to the hawtio project.
One of the things that we agreed that bugged us about most technical books was that the code frequently did not work. So right at the start we decided that every single snippet of code had to be taken straight from a fully-functional unit test. Whenever we made a statement in the book about how something behaved, we wrote a test for it (and found lots of interesting undocumented corner cases and gotchas, which we subsequently wrote up). The result is a massive set of examples, with 450 supporting tests – all readily usable (I have used them myself with clients on site). If you are interested in taking a look, all of the code is available on github at CamelCookbook/camel-cookbook-examples.
From the feedback that we have received from our reviewers – both formal and informal – is that we hit the mark; something we are really thrilled about. We were really privileged to have a number of Camel committers reviewing the book as well as our own clients who had varying levels of expertise with the framework. Many thanks go out to Claus Ibsen, Christian Posta, Bilgin Ibryam and Phil Wilkins for going through it all with a fine-toothed comb.
We hope that the book proves useful to the entire Apache Camel community, and further popularizes this amazingly productive integration framework.