camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Bindy - Avoiding bindy to discard a chunk of data when one line has incorrect format
Date Fri, 27 Jan 2012 16:04:43 GMT
On Fri, Jan 27, 2012 at 3:19 PM, Aida <ai.desu@gmail.com> wrote:
> Hi,
>
> I'm working with bindy to process a file. I use a splitter (something
> similar to what it is said here by Claus:
> http://stackoverflow.com/questions/8122748/best-strategy-for-processing-large-csv-files-in-apache-camel)
> so I can send chunks of data in parallel.
>
> The thing is that, if in a (csv) file I have one column in a line with an
> incorrect format, bindy throws an Exception and the chunk is lost. I wanted
> to know if it's possible to configure something so bindy discards only that
> line and keeps processing the other lines that comes in the chunk (so I only
> loose the line with a bad format).
>

If you split the file on a line-by-line basis (such as tokenizer with
\n), then the splitter will by default process all the lines.
And only at the end thrown an exception if one of the lines failed.

You can then configure an onException, to catch those exceptions and
just ignore by handling the exception.

Maybe something alike this which logs what line failed.

onException(Exception.class).handled(true).log("This line failed with
data ${body}");




> Thanks in advance.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-Avoiding-bindy-to-discard-a-chunk-of-data-when-one-line-has-incorrect-format-tp5435521p5435521.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message