Hi

I think you need to implement Closable in your custom reader, eg
whatever you pass on to the splitter would be auto closed in case of
exception if its closable.

On Tue, Aug 11, 2015 at 2:29 PM, GegeFR <[email protected]> wrote:
> Hi, I'm currently handling quite big files in camel (100s of MB).
>
> I'm splitting the file in multiple chunk. In order to be able to do it
> without fully loading the file into memory, i use a custom split method,
> that generates an iterator.
>
> That iterator is wrapping a "Reader" that read multiple lines when next() is
> called, and then generates a message. Everything is OK and memory usage is
> very low, perfect.
>
> I made sure i closed my reader when i'm finished or if an error happend in
> the iterator (things like IOExceptions).
>
> However when an error happen IN the <split> </split>, like, when sending the
> data to kafka, then my iterator does not seem to know it, and cannot close
> the Reader and the file stays open.
>
> So ... Later ... When trying again the file, it cannot be locked (rename).
>
> Is there a way for my iterator to know when an error happens later in the
> route, so that it can free the reader or inputstream ?
>
> B.R.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/free-resources-when-error-happen-splitting-with-custom-method-tp5770573.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Reply via email to