pfx-csv:streamingUnmarshal

Creates CSVParser from the input and stores it in the message body.

If you want to reuse CSVParser for multiple reads, use the URI option useReusableParser=true (see below).

Properties

Option

Type

Default

Description

Option

Type

Default

Description

commentMarker

string

 

Sets the comment marker of the reference format.

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 the trim.

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

 

Determines whether the 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.

useReusableParser

Boolean

false

Determines whether to use ReusableCSVParser class. ReusableCSVParser has the method getCSVParser which allows you to obtain Apache CSVReader that you can work with. This method also resets the input stream obtained from entry input so it can be reused multiple times (e.g. for reading the header from CSV file).

Examples

You can use streamingUnmarshal to load data into Pricefx. The pfx-api:loaddataFile component uses CSVParser internally to parse and load data, without the need to use <split> inside the Camel route.

<loadMapper id="productMapper" includeUnmappedProperties="false"> <body in="sku"/> <body in="name" out="label/> </loadMapper> <routes xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="direct:create"/> <to uri="pfx-io:streamCompressedFile"/> <to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true"/> <to uri="pfx-api:loaddataFile?batchSize=500000&amp;mapper=productMapper&amp;objectType=P"/> <log message="Done"/> </route> </routes>

IntegrationManager version 5.8.0