Hello,
I'm currently defining a default abstract job. That job will be extended by concrete jobs. The default abstract job may contain properties like: skip-policy, start-limit, etc.
However, it becomes difficult to right that configuration. I try something like this:
(This solution is incomplete and some parts must be redefined).Code:<bean id="skipPolicy" class="com.bsb.sf.batch.DefaultSkipPolicyTest" /> <bean id="defaultJobTasklet" abstract="true" class="org.springframework.batch.core.step.tasklet.TaskletStep"> </bean> <bean id="defaultChunkProcessor" class="org.springframework.batch.core.step.item.FaultTolerantChunkProcessor" abstract="true"> <property name="ProcessSkipPolicy" value="skipPolicy" /> </bean> <bean id="defaultMainStep" abstract="true" class="org.springframework.batch.core.step.item.ChunkOrientedTasklet"> <constructor-arg index="0"> <bean id="chunkProcessor" class="org.springframework.batch.core.step.item.FaultTolerantChunkProcessor" parent="defaultChunkProcessor"> <constructor-arg index="0" ref="exceptionItemProcessor" /> <constructor-arg index="1" ref="itemWriterCounter" /> <property name="ProcessSkipPolicy" value="skipPolicy" /> </bean> </constructor-arg> <constructor-arg index="1" ref="chunkProvider" /> </bean> <bean id="defaultBatchJob" abstract="true" class="org.springframework.batch.core.job.SimpleJob"> <property name="steps"> <list> <bean parent="defaultJobTasklet"> <property name="tasklet" ref="defaultMainStep" /> </bean> </list> </property> </bean>
As you can see, this solution is highly linked to a certain solution. Is there any way to define an abstract job with that properties (skip-policy, start-limit, allow-start-if-complete) ?
A solution could be to define that properties in jobs and not only in chunks:
<job id="defaultBatchJob" abstract="true" skip-policy="myPackage.MyClass" />
Another partial solution for skipability could be the creation of two interface SkippableException and NonSkippableException. Exception implementing that interfaces will be automatically ignored, or not.
Best,
Sébastien


Reply With Quote