Which version of Camel do you use [1]? Checkout [2] -> stopOnException how to continue if an exception occurs (use a custom AggregationStrategy). And because it's a custom splitter, you have the full control how to handle the error...
[1] http://camel.apache.org/how-can-i-get-help.html [2] http://camel.apache.org/splitter.html Best, Christian On Sun, Sep 9, 2012 at 4:09 PM, Tim Dudgeon <tdudgeon...@gmail.com> wrote: > I've got a route that splits a large file into records, using a splitter. > Its basically working but I can't get it to tolerate errors during the > splitting. The route terminates on the first error, but I want that error > to be caught so that the bad record can be logged and processing continue > with the next record. > I'm trying something like this in Groovy, but its not working. > > camelContext.addRoutes(new RouteBuilder() { > def void configure() { > > onException(IOException).**handled(true).log('ERROR') > > from("file://C:/Users/**username/tmp/examples/in?**fileName=letters.txt") > .log('Processing file ${header.CamelFileName}') > .split(bean('splitter', 'split')).streaming() > .log('Found ${body}') > } > }) > > > My simple example splits the text in the file into individual characters, > but throws IOException when a 'Z' is encountered. > The route halts at the first 'Z'. > What am I doing wrong? > > Thanks > Tim > > > --