-
Sep 1st, 2011, 05:13 PM
#1
Exception Handling with JDBCCursorItemReader
I'm new to Spring Batch and am seeking help regarding the following.
I have a job with a single step which has an itemReader, itemProcessor and ItemWriter.
The itemReader simply uses the out-of-the-box JDBCCursorItemReader to extract data from a database table and pass it on to be processed and written.
If the itemReader hits, for example, a database connection error, the batch should not only log the exception but should also associate a particular business code to this exception (ex.: when database connection exception, code= IDBJ0001E - Cannot connect to database).
How can we do this with Spring Batch?
Since it is out of the box, I can't insert try/catch, and I don't see the purpose of writing a in-house itemReader since the out-of-the-box version does the job....
Please help!
Thanks in advance!
-
Sep 1st, 2011, 10:46 PM
#2
You can do this in a listener. You can use a ItemReadListener. This is Called before and after an item is read and when an exception occurs while reading an item.
-
Sep 8th, 2011, 05:28 PM
#3
thanks for your help and advice. We're looking into making listeners work for us!
thanks again!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules