spring-projects / spring-projects/spring-batch
Using chunk-completion-policy gives an error [BATCH-2670]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
Azat opened BATCH-2670 and commented
We have the following tasklet:
<tasklet>
<chunk reader="detail-reader"
writer="detail-writer"
commit-interval="0"
chunk-completion-policy="singleChunkCompletionPolicy"/>
</tasklet>
And it works fine. But the spring documentation says to use either this or chunk-completion-policy but not both.
So now if I remove commit-interval="0" it gives an error:
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1634)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 60 more
Caused by: java.lang.IllegalStateException: You must specify either a chunkCompletionPolicy or a commitInterval but not both.
at org.springframework.util.Assert.state(Assert.java:70)
at org.springframework.batch.core.step.builder.SimpleStepBuilder.chunk(SimpleStepBuilder.java:190)
at org.springframework.batch.core.configuration.xml.StepParserStepFactoryBean.createFaultTolerantStep(StepParserStepFactoryBean.java:353)
at org.springframework.batch.core.configuration.xml.StepParserStepFactoryBean.getObject(StepParserStepFactoryBean.java:274)
at org.springframework.batch.core.configuration.xml.StepParserStepFactoryBean.getObject(StepParserStepFactoryBean.java:113)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 65 more```
Expected result:
It should let us to specify chunk-completion-policy without setting commit-interval to zero.
Affects: 3.0.7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the XML configuration using chunk-completion-policy without commit-interval, then start at StepParserStepFactoryBean.createFaultTolerantStep and follow the call into SimpleStepBuilder.chunk. Compare how the two chunk attributes are passed to the builder. Done means the configuration is accepted with the completion policy alone and the reported IllegalStateException no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100