pfx-csv:unmarshal
Allows you to extract data structures from an input CSV file.
Properties
Option | Type | Default | Description |
---|---|---|---|
| Boolean | true | Sets whether to return CSV headers for a message that was split (message contains a header CamelSplitIndex). |
| string | Â | Sets the comment marker of the reference format. |
| Boolean | false | Sets whether only synchronous processing should be used or whether Camel is allowed to use asynchronous processing (if supported). |
| string |  | Sets the quote mode. |
| string | Â | Â |
| Boolean |  | Determines whether empty lines should be ignored. |
| string |  | Sets the escape character to use. |
| Boolean | Â | Sets the trailing delimiter. |
| Boolean |  | Determines whether to ignore surrounding spaces. |
| Boolean |  | Determines whether to skip the header record in the output. |
| Boolean | Â | Sets trim. |
| Boolean | true | Determines whether the unmarshalling should produce maps for the lines values instead of lists. It requires to have a header (either defined or collected). |
| string |  | Sets the delimiter to use. The default value is a comma. |
| string |  | Sets the header comments. |
| string | Â | Sets the null string. |
| string | Â | Used to configure the CSV headers. |
| Boolean | Â | Sets that header case is ignored. |
| Boolean | Â | Determines whether to allow missing column names. |
| string | Â | Sets a quote character. |
| string | Â | Sets the record separator (= new line)Â which is by default set according to the OS default value. |
Examples
Basic usage
<route>
<from uri="direct:start"/>
<to uri="pfx-csv:unmarshal"/>
<to uri="mock:end"/>
</route>
This example shows how to use the marshaler in raw form.
When sent:
sku,name
10,BMW
11,AUDI
12,BMW
13,AUDI
then received:
[[sku: 10, name: 'BMW'], [sku: 11, name: 'AUDI'], [sku: 12, name: 'BMW'], [sku: 13, name: 'AUDI']]
Â
Using optional parsing parameters
<route>
<from uri="direct:start"/>
<to uri="pfx-csv:unmarshal?recordSeparator=CR&quoteMode=ALL&quoteCharacter="&escapeCharacter=^&header=${exchangeProperty[outputHeader]}&delimiter=-&skipHeaderRecord=false"/>
<to uri="mock:end"/>
</route>
Having outputHeader
= [mySku, myName]
and having body:
mySku-myName (/r)
'10'-'BMW' (/r)
'11'-'AUDI' (/r)
'12'-'BMW' (/r)
'13'-'AUDI' (/r)
will yield:
[[sku: 10, name: 'BMW'], [sku: 11, name: 'AUDI'], [sku: 12, name: 'BMW'], [sku: 13, name: 'AUDI']]
Â
IntegrationManager version 5.8.0