# Content Enricher and Content Filter

**In short:** A Content Enricher adds data that a receiver needs but the sender lacks. A Content Filter does the opposite and removes data the receiver does not need. Both reshape messages to fit the receiver.

## Explanation

Systems exchange messages, which are packages of data sent between applications. A sender's message rarely matches what the receiver needs. Two patterns fix this in opposite directions.

**Content Enricher.** It handles the case where the sender does not have all the data items the receiver requires. The enricher adds the missing items to the message before it moves on.

An enricher can work in two ways:

- It computes the missing data itself and needs no external source. This form is very similar to a Message Translator, which converts a message from one format to another.
- It fetches the data from elsewhere. Apache Camel's Enrich EIP is the most common example. It uses a producer, a component that calls out to get data. Camel caches producers for reuse. You can set the cache size or turn the cache off.

**Content Filter.** It handles the opposite problem. A message is large, but the receiver cares about only a few items. The filter strips the unimportant items and keeps the important ones. The pattern description notes that surprisingly many situations call for removing data.

The two patterns are mirror images. One grows a message. The other shrinks it.

## Example

An order system sends a message with a customer ID and a list of items. A shipping system needs the customer's delivery address, which the order system does not hold. An enricher gets the address and adds it to the message.

The same message also carries many order details that shipping ignores. A filter removes them. Shipping receives a smaller message with only what it needs.

## Trade-offs

The verified facts say little about costs. One point follows from how enrichment works: an enricher that fetches data relies on a producer to reach another source. Camel lets you tune or disable its producer cache, so caching is a setting you can choose.

A message gains missing data in the enricher, then loses unneeded data in the filter.

```mermaid
flowchart LR
  A[Sender message] --> E[Content Enricher]
  S[(Other source)] -.-> E
  E --> F[Content Filter]
  F --> R[Receiver]
```

## Checks

- Where a receiver needs data the sender does not hold, the document names an enrichment step that supplies it.
- Where receivers need only a few items from a large message, the document names a filtering step that removes the rest.
- Where enrichment calls another source through Camel's Enrich EIP, the document states the producer cache setting.

## Related

- [Message Translator](https://arc.fuet.ch/concepts/integration/message-translator.md)
- [Message Filter](https://arc.fuet.ch/concepts/integration/message-filter.md)
- [Content Filter](https://arc.fuet.ch/concepts/integration/content-filter.md)
- [Envelope Wrapper](https://arc.fuet.ch/concepts/integration/envelope-wrapper.md)
- [Claim Check](https://arc.fuet.ch/concepts/integration/claim-check.md)
- [Canonical Data Model](https://arc.fuet.ch/concepts/integration/canonical-data-model.md)
- [Enterprise Integration Patterns](https://arc.fuet.ch/concepts/integration/messaging-pattern-language.md)
- [Pipes and Filters](https://arc.fuet.ch/concepts/styles-patterns/pipes-and-filters.md)

## Sources

- [Content Enricher - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/DataEnricher.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Content Filter - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/ContentFilter.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Enrich :: Apache Camel](https://camel.apache.org/components/4.22.x/eips/enrich-eip.html) — camel.apache.org, accessed 2026-11-09
