Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Multiple Processors Inside Message Enricher Component

DZone's Guide to

Multiple Processors Inside Message Enricher Component

In this article, a software architect shows how to use more than one component inside Message Enricher and change the message format.

· Integration Zone ·
Free Resource

How to Transform Your Business in the Digital Age: Learn how organizations are re-architecting their integration strategy with data-driven app integration for true digital transformation.

In this article, we will see how to use more than one component inside Message Enricher and change the message format. Message Enricher helps us to load a value into a variable without affecting the current payload. But if you want to use more than one component for any other purpose or consider a scenario where we need to change the format of the variable before assigning it, we need to use a processor chain component.

Consider a scenario where we need to read a JSON error file from an object store and assign it to a variable so that we can use the same file later. For that, the JSON file object should be assigned as JSON. 

Firstly, configure the enricher component as below. Here, we are loading the payload into the ErrorCodes flow variable using a processor chain, so that I can place more than one component inside the message enricher component.

Image title

Secondly, read the JSON file from the object store and that will be our payload, but the message format will be different.

Image title

Now we have the payload and have set the format using the Set Payload component as below.

Image title

And now we have read an object store value and assigned it to a flow variable as a JSON message.

Make your mark on the industry’s leading annual report. Fill out the State of API Integration 2019 Survey and receive $25 to the Cloud Elements store.

Topics:
mulesoft ,message enricher ,integration

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}