Enrich — Enriches a message with data from a secondary resource
The Enrich pattern uses a producer to pull data from an endpoint outside of the route and
uses it to enrich the message the route is processing. An
AggregationStrategy is used to determine how the data is
combined.
The Enrich pattern can be used anywhere in the body of a route.
The Enrich pattern is typically used with request-response messaging; for example, to enrich the current message with the reply from a web service call.
![]() | Tip |
|---|---|
Use the Poll Enrich pattern when enriching files because the Enrich pattern will write the message content as a file. |
Table 49 describes the properties you can specify using the properties editor.
Table 49. Enrich Properties
| Name | Description |
|---|---|
| Language | Specifies the expression that computes the endpoint URI to use as a resource endpoint to enrich from. |
| Aggregate On Exception | Specifies whether users can control how to handle exceptions thrown during the aggregate method (for example, whether to suppress the exception, set a custom message body, or something else). The default is |
| Cache Size | Specifies the maximum size used to cache and reuse the producer when URIs are reused. |
| Description | Specifies a text description for the node. This description is included in the generated XML file, but it is informational only. It is not used by Apache Camel. |
| Id | Specifies a unique identifier for the endpoint. The tooling automatically generates an id for a node when it is created, but you can remove that id or replace it with your own. The Camel debugger requires all nodes with a breakpoint set to have a unique id. You can use the id to refer to endpoints in your Camel XML file. |
| Ignore Invalid Endpoint | When selected ignores the invalid endpoint exception when that endpoint is used to create a producer. |
| Share Unit of Work | Specifies whether all of the resulting exchanges are considered a single shared
unit of work. The default is Disabled. |
| Strategy Method Allow Null | Specifies whether the aggregate method is used when there is no data to
enrich. If disabled, it is not used. If enabled, null values are used as
the oldExchange when POJOs are used as
the AggregationStrategy. |
| Strategy Method Name | Specifies the method name to use when POJOs are used as the
AggregationStrategy. |
| Strategy Ref | Specifies a reference for looking up the
AggregationStrategy in the registry. |