Upload
giuseppe-fiore
View
104
Download
0
Embed Size (px)
Citation preview
CREATE BY GIUSEPPE FIORE
Example transformation from CSV to XML
MULESOFT TRAINING
CREATE BY GIUSEPPE FIORE
Through this example you will be ablo to:
1) Using component «file connector» to read and to write file CSV
2) Using DataMapper to convert CSV to Maps3) Using converter component «Maps To XML»4) Using component «Logger»5) Build and Debug Application with AnyPointStudio
CREATE BY GIUSEPPE FIORE
Using component «File Connector» to read and to write file CSVThe File connector allows your Mule application to exchange files with a file system. You can implement the File connector as an inbound endpoint (such as, a message source), or as an outbound endpoint. This endpoint implements a one-way exchange pattern only.
You can read this article for more information about file connector: https://docs.mulesoft.com/mule-user-guide/v/3.7/file-connector
CREATE BY GIUSEPPE FIORE
Using DataMapper to convert CSV to MapsDataMapper is a Mule transformer that delivers simple, yet powerful, visual design of complex data transformations for use in Mule flows, including:
Extraction and loading of flat and structured data formats Filtering, extraction and transformation of input data using XPath and powerful scripting Augmenting data with input parameters and lookups from other data sources Live design-time previews of transformation results High-performance, scalable data mapping operations
CREATE BY GIUSEPPE FIORE
Using converter component «Maps To XML»
The Component «Maps To XML» convert a List of object to XML type.
In this case not required configuration.
CREATE BY GIUSEPPE FIORE
Using Logger
Use the Logger to log messages such as error messages, status notifications, or exceptions.
CREATE BY GIUSEPPE FIORE
Build and Debug Application with AnyPointStudio
Insert a new breakpoint on component «DataMapper Transformer»
CREATE BY GIUSEPPE FIORE
Build and Debug Application with AnyPointStudio
Create a new debug configuration like show in this picture:
… after you can click on button «Debug»
CREATE BY GIUSEPPE FIORE
Build and Debug Application with AnyPointStudio
Copy a new file csv into folder «/input». The after copy the debug will be started:
Click F6 for the next processor ….
CREATE BY GIUSEPPE FIORE
Build and Debug Application with AnyPointStudio
Click F6 for the next processor ….
CREATE BY GIUSEPPE FIORE
Build and Debug Application with AnyPointStudio
Click F6 for the next processor ….
CREATE BY GIUSEPPE FIORE
Build and Debug Application with AnyPointStudio
you can show the result on console: