Mule4 - Dynamic Evaluate - Processor/Component
Dynamic Evaluate:
The Dynamic Evaluate component/processor in Mule4 evaluates an expression to select DataWeave script, and then executes the new script to generate a result. This behavior enables you to dynamically select the script, instead of hardcoding it into the Transform Message component based on condition.
Usecase/scenario:
1. DataWeave script varies based on program id and its security id .
2. if there are 15 programs currently and may grow in future, In this scenario instead of writing if elseif condition based on program id and security id in a single dataweave script.
3. Modularize by writing separate dwl script for each program id and security id combination.
4. Name each dataweave script such a way that program id and security id are part of it in order to resolve which script to dynamically evaluate at runtime.
Example of dataweave without "Dynamic Evaluate" Component(illustration only):
Example of dataweave with "Dynamic Evaluate" component:
Using Transform.
Using File Component(File Read): Assuming that onPrem mule server and in anypoint studio - that these dwl files are copied to server location.
Comments
Post a Comment