Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Call Another Flow From Dataweave

This is a simple example showing how to call another Flow and include that result in the resultant xml file. The opertaion "lookup" should be used in dataweave.



xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">






dataweaveexample.User u1 = new dataweaveexample.User();
u1.setName("DataWeave");
u1.setEmail("[email protected]");
u1.setRate(148.3385);
dataweaveexample.User u2 = new dataweaveexample.User();
u2.setName("Example");
u2.setEmail("[email protected]");
u2.setRate(28.3385);
List list = new java.util.ArrayList();
list.add(u1);
list.add(u2);
payload = list;
]]>





%output application/xml
---
{
users:{(payload map {
user:{
name:$.name,
email:$.email,
count:$$+1,
rate: $.rate as :string {format :"###,00"},
flowValue:lookup("callFromAnotherFlow",$)
}
})
}
}]]>








Post Comments and Suggestions !!!


This post first appeared on JavaRoots, please read the originial post: here

Share the post

How to Call Another Flow From Dataweave

×

Subscribe to Javaroots

Get updates delivered right to your inbox!

Thank you for your subscription

×