camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From furchess123 <>
Subject splitter().tokenize(...) does not recognize new lines in file uploaded using Spring MVC MultipartFile
Date Tue, 27 Oct 2015 21:01:44 GMT
I have a route configuration that uses splitter().tokenize(...):

                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

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 that uses the
exact text-book method described  here.

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 separate exchanges, and the route always puts all
lines into the same exchange body that is eventually handed over to my
"csvHandler" bean.  Note that the individual lines are recognized and get
unmarshalled correctly. But all lines are processed in a single exchange. So
far, this strange behavior /only/ happens with files the have been uploaded
and via my Spring MVC application with the bytes extracted from the
insurance of Spring's MultipartFile object that arrives at the MVC
controller's request handler method.

Anyone has an idea why? Is this a bug? 
Thanks for any help!

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message