...
Name | Default Value | Description |
---|---|---|
delimiter | ',' | the default character delimiter for delimited files |
textQualifier | '"' | the text qualifier delimited files |
ignoreFirstRecord | true | whether the first line is ignored for delimited files (for the column headers) |
splitRows | true | As of Camel 1.5 the component can either process each row one by one or the entire content at once. |
Message Headers
Camel will store the following headers on the IN message:
Header | Description |
---|---|
camelFlatpackCounter | The current row index |
Message Body
The component delivers the data in the IN message as a DataSetList
object that has converters for Map
or List
.
Usually you want the Map if you process one row at a time (splitRows=true). The List is useful for the entire content (splitRows=false), where each element in the list is a Map.
Each Map contain the key for the column name and the value.
For example to get the firstname from the sample below:
Code Block | ||||
---|---|---|---|---|
| ||||
Map row = exchange.getIn().getBody(Map.class);
String firstName = row.get("FIRSTNAME");
|
However you can also always get it as a List even for splitRows=true. The sample example:
Code Block | ||||
---|---|---|---|---|
| ||||
List data = exchange.getIn().getBody(List.class);
Map row = (Map)data.get(0);
String firstName = row.get("FIRSTNAME");
|
Header and Trailer records
In Camel 1.5 onwards the header and trailer notions in Flatpack is supported. However it is required that you must use a fixed record id names:
header
for the header record (must be lowercase)trailer
for the trailer record (must be lowercase)
...