Reputation: 3722
i have a Mule flow that gathers calculations information from an external service to enrich a list of Invoices. So, I end up (after the enricher scope) with my calc info in a flow variable, and my original invoices in the payload.
Can I use the data mapper to inject my calculation values into the existing invoice objects?
Currently I'm using a Groovy script - but prefer config over scripting.
Upvotes: 0
Views: 135
Reputation: 11606
You can use the datamapper transformer within an enricher scope to enrich parts of the payload.
The enricher can enrich the payload if you set the 'target' to a named field on a POJO for example, or if your payload is a Map, the enricher will add a new entry to the Map.
<enricher>
<datamapper... />
<enrich target="#[payload.field1]" source="#[payload.datamapperoutputfield1]" />
<enrich target="#[payload.field2]" source="#[payload.datamapperoutputfield1]" />
</enricher>
Upvotes: 2