camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Reading CSV as Map not List
Date Wed, 03 Oct 2012 03:52:41 GMT
On Tue, Oct 2, 2012 at 8:20 PM, Tim Dudgeon <> wrote:
> On 02/10/2012 19:07, Christian Müller wrote:
>> That would be a incompatible change. And what if the user don't want to
>> specify the keys?
> I was more asking if there was an option to allow this, not asking for a
> change in behaviour.
> Would be useful e.g. if the data was to be inserted into a database using
> SQL, where the keys were the column names.
> I think it could somehow be done with a custom Aggregator, but hoping there
> was already a solution.

Maybe an option could be added, to enrich the message with a header
that has the header columns as a List<String>.
Then you can use that to mimic a map, as you got the headers and the data.

That said, another option could be added to use List<Map> structure
instead. A LinkedHashMap should be used to ensure the ordering of the
map would be as a List.

We love contributions. So patches with unit tests is welcome.

>> Do you have an issue with the current implementation?
> Not at all. Just doesn't support my use case ;-)
> Tim
>> Best,
>> Christian
>> Sent from a mobile device
>> Am 02.10.2012 17:05 schrieb "Tim Dudgeon" <>:
>>> Is it possible to use the CSV component to read a CSV file and return a
>>> List<Map<String,String>>?
>>> The keys being the values in the first line of the file.
>>> I can only see a way to get it to generate a List<List<String>>.
>>> Thanks
>>> Tim

Claus Ibsen
Red Hat, Inc.
FuseSource is now part of Red Hat
Twitter: davsclaus
Author of Camel in Action:

View raw message