I use the configurations below, - and want the job to process the resultset defined in the inputSource the every time the job is kicked off.
I debugged into the ItemProviderProcessTasklet and see that the itemProvider the 2nd. time the job is kicked off, returns null:
which just exists processing....Code:Object data = itemProvider.next(); if (data == null) { return ExitStatus.FINISHED; }
Using this configuration
How could I enable the inputsource/itemProvider being reset.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> <import resource="classpath:/springAccountBalancerCore-configurer.xml"/> <import resource="classpath:/springAccountBalancerCore-dao.xml"/> <import resource="classpath:/springAccountBalancerCore-biz.xml"/> <bean id="simpleTickerJob" class="org.springframework.batch.core.configuration.JobConfiguration" abstract="true"> <property name="restartable" value="false" /> <!--<property name="startLimit" value="1000"/>--> </bean> <bean parent="stepScope" /> <bean parent="jobConfigurationRegistryBeanPostProcessor" /> <bean id="tickerJob" parent="simpleTickerJob"> <property name="steps"> <bean id="tickerStep1" class="org.springframework.batch.execution.step.RepeatOperationsStepConfiguration"> <property name="tasklet"> <bean class="org.springframework.batch.execution.tasklet.RestartableItemProviderTasklet"> <property name="itemProvider"> <bean class="org.springframework.batch.item.provider.InputSourceItemProvider"> <property name="inputSource" ref="hibernateTickerJobInputSource"/> </bean> </property> <property name="itemProcessor"> <bean class="no.aftenposten.accountbalancer.batch.processor.SubscriptionLineTickerProcessor"> <property name="outputSource" ref="hibernateTickerJobOutputSource"/> <property name="deliveryCalendarManager" ref="deliveryCalendarManager"/> <property name="productLineDao" ref="productLineDao"/> <property name="subscriptionDao" ref="subscriptionDao"/> <property name="accountingManager" ref="accountingManager" /> </bean> </property> </bean> </property> <property name="allowStartIfComplete" value="true"/> <property name="chunkOperations"> <bean class="org.springframework.batch.repeat.support.RepeatTemplate"> <property name="interceptors" ref="hibernateTickerJobOutputSource"/> <property name="completionPolicy"> <bean class="org.springframework.batch.repeat.policy.SimpleCompletionPolicy"> <property name="chunkSize" value="1" /> </bean> </property> </bean> </property> <property name="stepOperations"> <bean class="org.springframework.batch.repeat.support.RepeatTemplate"> <property name="exceptionHandler"> <bean class="org.springframework.batch.repeat.exception.handler.SimpleLimitExceptionHandler" p:limit="2" p:useParent="true" p:type="java.lang.Exception" /> </property> </bean> </property> </bean> </property> </bean> <!-- This is a framework class that needs a delegate and also needs to be registered as a RepeatInterceptor in the chunk --> <bean id="hibernateTickerJobOutputSource" class="org.springframework.batch.io.support.HibernateAwareItemWriter"> <property name="sessionFactory" ref="sessionFactoryCoreAb" /> <property name="delegate" ref="subscriptionLineTickerJobWriter" /> </bean> <bean id="subscriptionLineTickerJobWriter" class="no.aftenposten.accountbalancer.batch.outputsource.AccountingWriter" parent="accountingJdbcDao"> </bean> <!--class="no.aftenposten.accountbalancer.batch.outputsource.AccountingWriter">--> <!--<property name="dataSource" ref="oracleDataSource" />--> <bean id="hibernateTickerJobInputSource" class="org.springframework.batch.io.cursor.JdbcCursorInputSource"> <property name="dataSource" ref="pulsDataSource"/> <property name="mapper"> <bean class="no.aftenposten.accountbalancer.batch.mapper.SubscriptionLineMapper"/> </property> <property name="sql" value="select * from SUBSCRIPTION_LINES where active = 1 and subscriptionLineId = 3"/> </bean> </beans>
Rgds.
Geir


Reply With Quote