Announcement Announcement Module
No announcement yet.
Injecting custom BackOff policy Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Injecting custom BackOff policy


    Newbie here ask for some direction...
    How to setup backoff policy in chunk? Since I'm expecting some exception on reading process and will retry after some time. I think to inject custom BackOff policy on my chunk. But in current xml schema, I can't find way to inject this.

    Environment on Spring-Batch 2.0.4.RELEASE

    Last edited by abbas; Nov 14th, 2009, 09:47 AM.

  • #2

    BackOffPolicy can be applied to the step through the parent. Here is an example:

    <job id="neatJob" xmlns="">
        <step id="neatStep" parent="fatherStep">
                <chunk reader="neatReader" writer="neatWriter" commit-interval="${job.commit.interval}" />
    <bean id="fatherStep" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean">
        <property name="transactionManager" ref="transactionManager" />
        <property name="jobRepository" ref="jobRepository" />
        <property name="backOffPolicy">
        <bean class="org.springframework.batch.retry.backoff.FixedBackOffPolicy">
            <property name="backOffPeriod" value="8000" />
    Currently however 'backOffPolicy' property is not supported by 'namespaced' configuration. I created a JIRA with a patch you can look at/apply to make the above example work:


    • #3
      litius, thanks for the response, I'll try that.

      BTW, from what I see on your patch, it could be used to create attribute for backoff-policy (by editing spring-batch.xsd?) for chunkTaskletType, is it possible or would it broke something else?


      • #4

        If you follow a discussion on JIRA, Dan (who actually wrote a parser), found that if you use a 'parent' attribute of the 'step', but will not include the 'tasklet' tag, it should work without a patch.

        I would not modify XSD just yet


        • #5
          Hmm, another alternative, I'll give it a try too...

          Yet I still think it would be good to have backoff policy attribute in the schema...