camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dudgeon <tdudgeon...@gmail.com>
Subject Re: Surviving exceptions during splitting
Date Sun, 09 Sep 2012 16:25:56 GMT
Hi,
I'm using 2.10 version.

Yes, its a custom splitter so I could handle the exception. But not sure 
what I would do with it, or whethr that is really a good thing to do.

stopOnException seems to relate to exceptions that occur downstream of 
the splitter, not from the splitting itself?
And I'm not needing to aggregate the results, so don't need an 
AggregationStrategy.

Thanks
Tim

On 09/09/2012 16:58, Christian Müller wrote:
> 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.ml@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
>>
>>
>>
>
> --
>


Mime
View raw message