pfx-csv:unmarshal

Allows you to extract data structures from an input CSV file.

Properties

Option

Type

Default

Description

Option

Type

Default

Description

camelSplitIndexAware

Boolean

true

Sets whether to return CSV headers for a message that was split (message contains a header CamelSplitIndex).

commentMarker

string

 

Sets the comment marker of the reference format.

synchronous

Boolean

false

Sets whether only synchronous processing should be used or whether Camel is allowed to use asynchronous processing (if supported).

quoteMode

string

 

Sets the quote mode. 

format

string

 

 

ignoreEmptyLines

Boolean

 

Determines whether empty lines should be ignored. 

escapeCharacter

string

 

Sets the escape character to use. 

trailingDelimiter

Boolean

 

Sets the trailing delimiter.

ignoreSurroundingSpaces

Boolean

 

Determines whether to ignore surrounding spaces. 

skipHeaderRecord

Boolean

 

Determines whether to skip the header record in the output. 

trim

Boolean

 

Sets trim.

useMaps

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).

delimiter

string

 

Sets the delimiter to use. The default value is a comma. 

headerComments

string

 

Sets the header comments. 

nullString

string

 

Sets the null string.

header

string

 

Used to configure the CSV headers.

ignoreHeaderCase

Boolean

 

Sets that header case is ignored.

allowMissingColumnNames

Boolean

 

Determines whether to allow missing column names.

quoteCharacter

string

 

Sets a quote character.

recordSeparator

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&amp;quoteMode=ALL&amp;quoteCharacter=&quot;&amp;escapeCharacter=^&amp;header=${exchangeProperty[outputHeader]}&amp;delimiter=-&amp;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