Charu Khurana
Charu Khurana

Reputation: 4551

Difference between Mule enricher and setting invocation variable

Is there any difference between setting a variable within Mule flow using <set-variable> versus setting a variable using enricher like <enricher target="#[variable:xyz]"\>

Upvotes: 0

Views: 1611

Answers (3)

Mohan
Mohan

Reputation: 520

there was significant difference between the message en-richer and set property.

message-enricher: it will enrich the mule message by calling external system or do some transformation to existing payload and save it into some scope of variable like session or outbound or invocation.Even if the transformation happens inside the message en-richer scope ,its doesn't effect the actual payload for the next component in flow.

set-property:

set property save some information extracted from payload or original payload to some invocation or flow scope variable.

Upvotes: 0

Ram Bavireddi
Ram Bavireddi

Reputation: 1187

What David Dossot described is absolutely correct. To add further to his description:

The Message Enricher allows the current message to be augmented using data from a seperate resource. The Mule implementation of the Enrichment Resource (a source of data to augment the current message) can be any Message Processor.

You can find Java API documentation for this at MessageEnricher.

And of course, reading the Java doc really helps us a lot.

Upvotes: 0

David Dossot
David Dossot

Reputation: 33413

The enricher is designed for performing interactions like calling an outbound endpoint and bringing the result back to the main flow.

Using it as a replacement for set-variable would be semantically wrong, even if it works.

Upvotes: 4

Related Questions