I have a route configuration that uses splitter().tokenize(...):

from(FILE_SPLITTER_ENDPOINT).routeId("fileSplitterRoute").
            split().
                tokenize(System.lineSeparator(), config.getLinesPerChunk()).
                streaming().          // enable streaming vs. reading all
into memory
                parallelProcessing(readerConfig.isParallelProcessing()). //
on/off concurrent processing of multiple chunks
                stopOnException().    // stop processing file if system
exception occurs (handled by onException clause)
                unmarshal().csv().    // unmarshal each chunk to Java (list
of String lists) using Camel's CSV component
                bean(csvHandler).     // hand each unmarshalled list of
lines/fields to bean that parses and validates codes
                bean(importProcessor).// process codes for import (depending
on operational mode and errors in exchange)
                to(AGGREGATE_ERRORS_ENDPOINT).      // delegate to nested
route to update error report
            end();

The number of lines for the tokenizer to group is taken from a configuration
bean. This works most of the time - unless the poller reads a file uploaded
into the staging directory by a Spring Web MVC application using the
text-book method described  here.
<https://spring.io/guides/gs/uploading-files/>   

When I view the uploaded file in any editor/viewer, it appears fine, all
line breaks are preserved. Nevertheless, Camel's tokenizer completely fails
to group the lines into chunks, and the route always puts all lines into the
exchange body. Anyone has an idea why? Is this a bug? Note that the
individual lines are recognized and get unmarshalled correctly.



--
View this message in context: 
http://camel.465427.n5.nabble.com/splitter-tokenize-does-not-recognize-new-lines-in-file-uploaded-using-Spring-MVC-MultipartFile-tp5773126.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to