Reputation: 4551
I have a file inbound endpoint
where a pipe delimited file will come in. The first line of the file is header and rest are records. On an average there would be 40K records making file size close to 7MB. I need to convert this file into XML structure (headers from file are not same as XML elements).
What is a good way to convert this file to XML? I wrote a component
which takes input stream
, read file line by line, tokenize it, create and write to an XML file. But in that case I am keeping file connection open for long time and I would have to take care about closing file stream and moving the file for backup.
Wondering what can be other way of doing it? Has anyone used Data Mapper
for similar purpose?
Upvotes: 1
Views: 1165
Reputation: 4015
Mule docs for DataMapper state that "DataMapper can parse a 500 MB CSV file using only about 75 MB of RAM" if you set the "streaming" property in DataMapper configuration. Pipe delemited counts as CSV, as you can configure the delimiter. You can also set it to ignore the header row. I would go for DataMapper, post another question if something fails, and only revert to a custom component when all hope is lost.
Upvotes: 1