I have a scenario where there is a variable defined in my mule flow. In the properties file, there is a property which is a String including the variable defined in the flow. When reading the property from property file, rather than replacing the variable by its value, it is printing it as a text. Mule runtime version is 4.2.2. This works as expected in Mule 3.x but facing issue in 4.x version.
<flow name="sample-testFlow1" doc:id="4138e351-316b-40af-a694-c416b5dc317f" >
<http:listener doc:name="Listener" doc:id="424c82c0-3e23-4f61-8e9b-62ec69711493" config-ref="HTTP_Listener_config" path="/test2"/>
<set-variable value='#["EmployeeCode"]' doc:name="Set Variable" doc:id="45bd2007-907b-4749-af14-001ad2cf82a6" variableName="testVariable"/>
<ee:transform doc:name="Transform Message" doc:id="e23dff81-a4e7-4d26-8f9e-b533442ddd5b" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0 output application/java --- p('test.prop')]]>/ee:set-payload>
</ee:message>
</ee:transform>
</flow>
Property File:
test.prop=Hello!Variable is #[vars.testVariable]
Expected Output: Hello!Variable is EmployeeCode
But getting as : Hello!Variable is #[vars.testVariable]
Any help is much appreciated.
Thank you.
You can take a look at the Parse Template Reference in Mule. I believe it'll make your solution much easier. Here's the link to the documentation page->https://docs.mulesoft.com/mule-runtime/4.3/parse-template-reference
Please let me know what you think.
Your suggestion worked exactly the way I wanted it to work. Thank you for your answer.