Apr 29th, 2011, 02:37 PM
Stop retry in chunk processing
The following is the use case for my batch. Read from the database, process the item by calling a web service, update the item in the database using item writer. I am returning the exception in the processor when the processing fails. The problem is it retries the chunk from element 0 again and that is causing my successfully processed items being reprocessed. In this case, it is a web service and hence cannot be rollback. Here is the snippet of the configuration in my job.
<batch:step id="loadData" parent="simpleStep">
<batch:chunk reader="sourceReader" processor="cbrItemProcessor"
<batch:stream ref="badItemWriter" />
<batch:listener ref="baseSkipListener" />
<batch:listener ref="dataCopyMailListener" />
<batch:next on="COMPLETED" to="filePurge" />
<batch:end on="FAILED" />
I did set the retry-limit=0 and still the retry couldnt be avoided. Could someone please help me on this?
Apr 30th, 2011, 09:03 PM
set the processor-transactional attribute to false in the chunk tag. Processed items won't be retried then.
Aug 8th, 2012, 10:32 AM
I can't thank you enough for this reply ! We had spent almost 2 days on a similar issue and this post saved our day !
Apologies, for digging out such an old thread !
Aug 9th, 2012, 01:35 PM
i have a similar problem, i only have a reader and writer. i am using the Example item reader and Example item writer, with slight modifications.
here is my job config
<job id="job1" xmlns="http://www.springframework.org/schema/batch" incrementer="jobParametersIncrementer">
<step id="step1" parent="simpleStep">
<chunk reader="reader" writer="writer" skip-limit="4" processor-transactional="false" >
<include class="java.lang.Exception" />
<bean id="reader" class="example.ExampleItemReader" />
<bean id="writer" class="example.ExampleItemWriter" />
my writer just throws java.lang.exception for every call. on every failed writer call, the writer called again. how can i prevent this. i have tried setting processor-transactional and it didnt work.
greatly appreciate help on this. its been more than 2 days trying this. seems very basic but didnt work.
Sep 19th, 2012, 09:55 AM
Thanks a ton!!
Originally Posted by arno