I tried to create a Data-Mapper example in mule in which both inbound and outbound endpoints are File, Looks some thing like.
When i execute this program output folder of file remains empty, Logically i assume that i need to put and HashMap to XML transformer between Data Mapper and Output File. More Over i created a csv file to xml file selecting from example option in data mapper. Initially i tried to use FTP endpoint it started resulting into error so i replaced FTP with file endpoint.
Here I am Sharing configuration.xml file
<mule xmlns:file="....>
<data-mapper:config name="sample_mapper_grf" transformationGraphPath="sample_mapper.grf" doc:name="DataMapper"/>
<flow name="CSV_to_XML_Data_MapperFlow1" doc:name="CSV_to_XML_Data_MapperFlow1">
<file:inbound-endpoint path="/home/jay/CSV_XML_/input" responseTimeout="10000" doc:name="Input File"/>
<data-mapper:transform config-ref="sample_mapper_grf" doc:name="DataMapper"/>
<file:outbound-endpoint path="/home/jay/CSV_XML_/output/" responseTimeout="10000" doc:name="Output File"/>
</flow>
</mule>
Data-Mapper configuration image is here
Add a Groovy component after the data mapper and try and dump the contents
println "post mapping payload " + payload
return payload
I got it resolved using.
here is the configuration.xml
<mule ....>
<data-mapper:config name="sample_mapper_grf"transformationGraphPath="sample_mapper.grf" doc:name="DataMapper"/>
<flow name="CSV_to_XML_Data_MapperFlow1" doc:name="CSV_to_XML_Data_MapperFlow1">
<file:inbound-endpoint path="/home/jay/CSV_XML_/input" responseTimeout="10000" doc:name="Input File"/>
<data-mapper:transform config-ref="sample_mapper_grf" doc:name="DataMapper"/>
<object-to-string-transformer doc:name="Object to String"/>
<file:outbound-endpoint path="/home/jay/Output" responseTimeout="10000" doc:name="File" outputPattern="#[function:dateStamp].xml"/>
</flow>
</mule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.