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

The State of API Integration 2018: Get Cloud Elements’ report for the most comprehensive breakdown of the API integration industry’s past, present, and future.

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.

Your API is not enough. Learn why (and how) leading SaaS providers are turning their products into platforms with API integration in the ebook, Build Platforms, Not Products from Cloud Elements.

Topics:
mulesoft ,message enricher ,integration

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}