Table of Contents
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.
Use the Poll Enrich pattern when enriching files because the Enrich pattern will write the message content as a file.
Table 75, “Enrich Properties” describes the properties you can specify using the properties editor.
Table 75. Enrich Properties
| Name | Description |
|---|---|
| Specifies the expression that computes the endpoint URI to use as a resource endpoint to enrich from. |
| 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 Disabled, which prevents use of the aggregate method when an exception occurs while attempting to retrieve the data to enrich from the resource. |
| Specifies the maximum size used to cache and reuse the producer when URIs are reused. |
| 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. |
| 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. |
| When selected ignores the invalid endpoint exception when that endpoint is used to create a producer. |
| Specifies whether all of the resulting exchanges are considered a single shared unit of work. The default is Disabled. |
| 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. |
| Specifies the method name to use when POJOs are used as the AggregationStrategy. |
| Specifies a reference for looking up the AggregationStrategy in the registry. |