Skip to main content
Version: 4.10.1

Enrich component

The Enrich component lets you take a sample of an ongoing message in your flow, in order to take some action with it while it goes through the flow. The tapped message is copied and any resulting routing runs in its own separate thread and thus will not affect the main flow. The seperate running thread MUST end in an endpoint to be able to return a message and enrich it to the original one.


The Enrich component has the following configuration options:

File TypeType of merging you want to do.


The Enrich component has two forwarding endpoints. The endpoint on the right side of the component that routes the enriched message, and the one on the bottom that starts a new thread and returns a new message that has to be enriched to the original one.

Following is an example of an Enrich use case. In this example, messages are received through an inbound http endpoint, processed with XSLT and sent to HTTP endpoint. An enrich component is used in this example to enrich the original incoming messages with a response from a SOAP endpoint. This does not happen in parallel with the main flow. The right endpoint will wait until it receives a response from the bottom flow and then send the enriched message to the XSLT component.

To make it more complicated, and a more relevant example, we want to retrieve information from the original message and use that to call an external webservice to ask for more information about that object. We can extract that information out of the original body, with xslt, and create a new message with it that we sent to an SOAP endpoint.

This SOAP endpoint will give back the response with the information, and the enrich component will enrich this to the original body. We then use an XSLT so we can use that enriched xml with all the information to create a new message that we can send to our final endpoint.

Enrich example

Below an example of an enriched message:

<?xml version="1.0"?>
<Order id="1234" />
<Order id="1235" />
<Order id="1236" />
<Order id="1237" />

To learn how to make an XSLT with MapForce read this tutorial

Add to zip archive

This option does pretty much what it says, it allows you to add a certain body to an existing zip archive. There are two important remarks that you should know using this option:

  1. Before the enrich you should already have a zip archive in your body, when this is not the case the file cannot be added as there is no zip archive to add it to.
  2. You can specify the target location in the zip archive with the CamelFileName header.

You can also use this option in combination with the Enrich Override if you want to get a zip archive from an external location and add bodies to that archive.

Below an example of a flow that enriches bodies to a zip archive:

Enrich to zip example

Add as attachment

This option is primarily meant for attachments that need to be sent by the email component. Say we already have a text or html body, but we still need to get or add some attachments. In this case we can use the enrich component with the "Add as attachment" file type.

Dovetail uses Multipart to add attachments to the existing body while keeping them seperate in the email. It is important to know that after you have used the Enrich with "Add as attachment" the body is transformed into multipart. An example of adding attachments to an email is shown in the image below.

In the SetHeader component you can specify the CamelFileName header which is used to set the filename of the attachment in the email. Dovetail will determine the type of attachment by itself, but when you want to override that you can simply set the Content-Type header.

Enrich as attachment example

Override type

With the Override type you can force the enrich component to override the current body with the new body. This can be done with any file as the Override option reads the new body as binary.

With this you can for example have an inbound http component, that reads an external PDF file with the enrich component, that overrides the current body and give that back to the inbound http by setting the flow to synchronous.