0
votes

Is there any listener interface that one could implement to handle exceptions thrown from ItemReader.open() methods? There's plenty of listener interfaces but no one seems to be suitable for this. i.e. ItemReadListener catches only exceptions from ItemReader.readItem() (similar to ChunkListener or ItemProcessListener etc.)

There are JobListener and StepListener interfaces but these two don't define methods that would be called in case of exception.

Is there any way how to do this?

1

1 Answers

0
votes

You may be able to use ChunkListener#onError(Exception e) to "catch" any exception within a chunk. This will work in certain implementations, like WebSphere Liberty / Open Liberty, but may not work in every implementation (since this was a grey area of the specification).