Mulesoft Data Mapper
This quick article gets you started up with DataMapper and shows how to configure an instance of DataMapper in your flow.
Join the DZone community and get the full member experience.
Join For FreeFirst of all, the latest Anypoint Studio doesn’t work with tools like DataMapper. Instead, Anypoint has come up with a tool like Transformation, but then Anypoint allows you to work with the tools which have already been deprecated. So for this connector to show up you need to go to Window > Preferences > Anypoint Studio > Palette Profiles and then on the right side select the runtime(s) and click the box labeled 'Show deprecated Mule components and attributes'.
Now on to the use of Data Mapper. Anypoint DataMapper takes data in a specific format and outputs the same data in the format of your choice. For example, you can take data stored as XML and output the same data in JSON format.
Both the input and the output can be in any of the formats supported by Mule:
"Flat," row-oriented formats:
CSV
Fixed-width
MS Excel sheets
Structured formats:
XML
JSON
POJO object trees
Key-value Maps
You configure DataMapper using its GUI, called the graphical mapping editor. This editor has two panes: an Input pane and an Output pane, where you define your input metadata (format, names of fields, etc.) and your output metadata respectively.
Basic Usage
Let’s start with some basic usage of DataMapper:
Configuring an instance of DataMapper in your flow involves several high-level steps:
Insert a DataMapper transformer at the desired location in your application flow.
Tell DataMapper what comes in and what comes out.
Click Create mapping to create an initial data mapping. DataMapper will automatically map corresponding fields between the input and output data and will leave any other fields unmapped.
If necessary, graphically modify the mapping, defining input elements and attributes to output elements and attributes:
With the above article, one can start up with DataMapper and get a little clue about what this connector is all about. We just need to manually match the connectors on both the input and output sides. However, values with the same name are sensed by Data Mapper itself and are mapped automatically.
Opinions expressed by DZone contributors are their own.
Comments