Apache Camel - Skip footer / last line

I'm using apache camel in a routing context to integrate some CSV files. If I want to skip the first line of the csv I can easily do it in the unmarshal:

<unmarshal>
            <csv delimiter=";" skipFirstLine="true"/>
</unmarshal>

My question is, whats the best way to ignore/skip the last line of the file ?

Thank you in advance,

Upvotes: 0

Views: 1110

Answers (2)

javalearner_heaven
javalearner_heaven

Reputation: 523

The last line can not be skipped. Please read the file from the end and remove the last line using a File Reader

Upvotes: 0

kris_k
kris_k

Reputation: 341

Camel CSV component (ver. 2.18.1) does not support skipping the footer out of the box. In case you can keep the whole file in memory I would advice to use a Camel processor to remove the last line before unmarshalling.

There is also a similar question answered by Claus Ibsen for the Bindy Component: Camel CSVRecord Camel Bindy

Upvotes: 2

Related Questions