Announcement Announcement Module
Collapse
No announcement yet.
How to resume processing after a failure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to resume processing after a failure

    After an exception occurred, my jobstarter calles the same jobinstance. This works ok, - but how could I make the job resume processing from the point where It failed, - after the last successfull commit?

    I use the JdbcCursorItemReader as the ItemReader, - could I this and also recover processing from the point where the processes failed?

    Geir

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
    
        <description>This file defines the job for the ticker process.</description>
    
        <bean id="tickerJob" parent="simpleJob">
            <property name="jobRepository" ref="simpleJobRepository"/>
            <property name="steps">
                <bean id="step1" parent="skipLimitStep">
                    <property name="itemReader" ref="jdbcTickerJobItemReader"/>
                    <property name="itemWriter" ref="tickerJobItemWriter"/>
                    <property name="commitInterval" value="5"/>
                </bean>
            </property>
        </bean>
    
        <bean id="tickerJobItemWriter"
              class="no.aftenposten.accountbalancer.batch.itemwriter.TickerJobItemWriter">
            <property name="accountingManager" ref="accountingManagerImpl"/>
            <property name="accountingDao" ref="accountingJdbcDao"/>
            <property name="productLineDao" ref="productLineHibernateDao"/>
            <property name="subscriptionDao" ref="subscriptionHibernateDao"/>
        </bean>
    
        <bean id="jdbcTickerJobItemReader" class="org.springframework.batch.item.database.JdbcCursorItemReader">
            <property name="dataSource" ref="pulsDataSource"/>
            <property name="mapper">
                <bean class="no.aftenposten.accountbalancer.batch.mapper.SubscriptionLineMapper"/>
            </property>
            <property name="sql">
                <bean factory-bean="queryFactory" factory-method="getTickerJobQuery"/>
            </property>
        </bean>
    </beans>

  • #2
    Seems you're missing saveState=true in the reader config.

    Comment


    • #3
      That worked out great!, - thanks!!

      Comment

      Working...
      X