Results 1 to 5 of 5

Thread: Stop retry in chunk processing

  1. #1
    Join Date
    Jul 2010
    Posts
    1

    Default 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:tasklet transaction-manager="transactionManager">
    <batch:chunk reader="sourceReader" processor="cbrItemProcessor"
    writer="targetWriter" skip-limit="1000000">
    <batch:streams>
    <batch:stream ref="badItemWriter" />
    </batch:streams>
    <batch:skippable-exception-classes>
    java.lang.Exception
    </batch:skippable-exception-classes>
    </batch:chunk>
    <batch:listeners>
    <batch:listener ref="baseSkipListener" />
    <batch:listener ref="dataCopyMailListener" />
    </batch:listeners>
    </batch:tasklet>
    <batch:next on="COMPLETED" to="filePurge" />
    <batch:end on="FAILED" />
    </batch:step>

    I did set the retry-limit=0 and still the retry couldnt be avoided. Could someone please help me on this?
    Regards,
    Shankar

  2. #2
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    set the processor-transactional attribute to false in the chunk tag. Processed items won't be retried then.

  3. #3

    Default

    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 !

  4. #4

    Default

    Hi
    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">
    <tasklet>
    <chunk reader="reader" writer="writer" skip-limit="4" processor-transactional="false" >
    <skippable-exception-classes>
    <include class="java.lang.Exception" />
    </skippable-exception-classes>
    </chunk>
    </tasklet>
    </step>
    </job>
    <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.

  5. #5
    Join Date
    Sep 2012
    Posts
    5

    Default

    Quote Originally Posted by arno View Post
    set the processor-transactional attribute to false in the chunk tag. Processed items won't be retried then.
    Thanks a ton!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •