pfx-csv:marshal

Provides an option to marshal a data structure into a 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:marshal"/> <to uri="mock:end"/> </route>

This example shows how to use the marshaler in raw form.

When sent:

sendBody("direct:start", [[sku: 10, name: 'BMW'], [sku: 11, name: 'AUDI'], [sku: 12, name: 'BMW'], [sku: 13, name: 'AUDI']])

then received:

sku,name 10,BMW 11,AUDI 12,BMW 13,AUDI

 

Using optional parsing parameters

Having outputHeader = [mySku, myName]

and having body = [[sku: 10, name: 'BMW'], [sku: 11, name: 'AUDI'], [sku: 12, name: 'BMW'], [sku: 13, name: 'AUDI']]

will yield:

This example illustrates most of the options defining the resulting CSV.

IntegrationManager version 5.8.0