# The 2003 book that still decides how a client's Camel routes behave

> Learn the pattern names behind Apache Camel and an FDE sees where messages go, duplicate and fail without tracing every line of XML.

Original: https://fdetimes.net/en/tools/apache-camel-integration-patterns-fde/

The Apache Camel home page advertises more than 350 connectors and more than 65 enterprise integration patterns. That figure of 65 dates from 2003. It is the number of patterns Gregor Hohpe and Bobby Woolf catalogued in *Enterprise Integration Patterns*, published by Addison-Wesley.

At clients whose Java middleware is written in Camel, that vocabulary still decides how data moves. The FDE's job is often to plug a new product, such as an agent or a data pipeline, into exactly that system.

An engineer who can read a route by its pattern names can narrow down a fault far faster. One who cannot is left combing through XML line by line.

## Camel is a vocabulary, not just a library

The official documentation defines Camel as an open-source integration framework based on the Enterprise Integration Patterns. Routes can be written in several DSLs: Java, XML or YAML. So when a client's legacy system uses XML and the new project uses YAML, you are still reading the same logic.

The detail to remember is that Camel supports *most* of the patterns in the book, though not every one. Camel's EIP catalog is organized into groups. Message Routing includes the Content-Based Router, Splitter, Recipient List and Routing Slip. Wire Tap sits under System Management, while Circuit Breaker and Saga belong to Error Handling and Resilience.

**Key point:** Read a route by its pattern names and thousands of lines of configuration shrink to a handful of decisions.

## One small route holds the three most important patterns

The Java DSL route below takes orders from a queue, filters duplicates, branches by order type and sends failed orders somewhere separate:

```java
errorHandler(deadLetterChannel("jms:queue:orders.dead"));

from("jms:queue:orders")
    .idempotentConsumer(header("orderId"), orderIdRepository)
    .choice()
        .when(header("type").isEqualTo("B2B")).to("direct:b2b")
        .otherwise().to("direct:retail");
```

`choice` is the Content-Based Router: it picks a destination based on the message content. `idempotentConsumer` filters duplicate messages using a repository that stores the ids of messages already processed. `deadLetterChannel` is an error handler: messages that fail processing are moved to a separate destination instead of disappearing.

Say the client's old warehouse system responds slowly and the sender retries on its own. Of 1,000 orders, 40 are sent a second time. Remove the `idempotentConsumer` line and the warehouse receives 1,040 dispatch orders. A bug like this throws no exception; it only surfaces when accounting reconciles the books.

## The two most common failures sit outside the business logic

The first is a repository that lives only in memory. For the route above, the most important question is where `orderIdRepository` is stored. If it is the in-memory version, every time the client restarts the service the list of processed ids is wiped, and retried orders arriving just afterwards slip through as new ones.

Apply that to the example: the route runs correctly all week, then an evening patch restarts the service just as the warehouse is running slow. The orders retried in that window become duplicate dispatch orders, and the logs record nothing unusual. That is why the repository question should come before you even reach the `choice` branch.

The Aggregator, the pattern that combines several messages into one, also relies on a repository and shares the same weakness. Camel lets you swap the Aggregator's repository and ships persistent options such as Redis, SQL and Infinispan. At a client, where services get restarted for patches or server moves, switching to a persistent store is usually the cheapest fix you can propose.

The second failure is a dead letter queue nobody watches. A Dead Letter Channel keeps failed messages, but if they sit there unread, the outcome for the client is the same as losing them. On day one, ask what the dead letter queue is called, how many messages it holds and who is alerted when it fills up.

## The version is a risk too

Camel's download page currently marks two LTS lines. The 4.22.x line runs on Java 17, 21 and 25 and reaches end of life in August 2027. The 4.18.x line runs on Java 17 and 21 and reaches end of life in February 2027. Enterprise middleware often sits on LTS lines older than these.

So before proposing new routes, record which Camel and Java versions the client runs. If they are on an older line, raise the upgrade with the client early rather than letting it become a surprise in the final week of the project.

## What to learn first so it pays off next week

The fastest route in is to install the Camel CLI through JBang. `camel init` creates a route file and `camel run` runs it, with no Maven project to set up. Rewrite the route above in YAML, then make one step fail on purpose. Seeing a failed message land in the dead letter queue with your own eyes teaches error handlers faster than reading the documentation.

Learn them in this order: Content-Based Router, Dead Letter Channel, Idempotent Consumer, then Aggregator. Those four answer the four basic questions about any integration flow: where messages go, where failures end up, why there are duplicates, and why something is missing. Splitter and Wire Tap come after.

On a CV, when an FDE job posting mentions "integration" or "legacy systems", a line such as "added an Idempotent Consumer with a persistent repository to a Camel route, eliminating duplicate orders when the target system retried" carries far more weight than the words "Apache Camel" sitting alone in a skills list.

The book is more than twenty years old, yet systems built on it still move real orders every day. An FDE who reads its language will find the problem while others are still opening XML files.

**Try this week:**

- Install the Camel CLI through JBang, then run `camel init` and `camel run` with a route that has a `choice` and a dead letter channel.
- Open an existing Camel route (a client's or an open-source project's) and write the EIP pattern name next to each step.
- Read Camel's EIP catalog and mark the patterns in the Message Routing and Error Handling groups.

## Sources

- [Apache Camel](https://camel.apache.org/)

- [What is Camel? – Apache Camel](https://camel.apache.org/manual/faq/what-is-camel.html)

- [Enterprise Integration Patterns – Apache Camel](https://camel.apache.org/components/latest/eips/enterprise-integration-patterns.html)

- [Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/)

- [Content-Based Router (Choice) EIP – Apache Camel](https://camel.apache.org/components/latest/eips/choice-eip.html)

- [Aggregate EIP – Apache Camel](https://camel.apache.org/components/latest/eips/aggregate-eip.html)

- [Idempotent Consumer EIP – Apache Camel](https://camel.apache.org/components/latest/eips/idempotentConsumer-eip.html)

- [Dead Letter Channel EIP – Apache Camel](https://camel.apache.org/components/latest/eips/dead-letter-channel.html)

- [Download – Apache Camel](https://camel.apache.org/download/)

- [Camel CLI – Apache Camel](https://camel.apache.org/manual/camel-jbang.html)
