I'm using Spring Batch to set up a job that will process a potentially very large XML file. I think I've set it up appropriately, but at runtime I'm finding that the job runs, processes its input, and then just hangs in an executing state (I can confirm by viewing the JobExecution's status in the JobRepository).
I've read through the Batch documentation several times but I don't see any obvious "make the job stop when out of input" configuration that I'm missing.
Here's the relevant portion of my application context:
<batch:job id="processPartnerUploads" restartable="true"> <batch:step id="processStuffHoldings"> <batch:tasklet> <batch:chunk reader="stuffReader" writer="stuffWriter" commit-interval="1"/> </batch:tasklet> </batch:step> </batch:job> <bean id="stuffReader" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="stuff" /> <property name="resource" value="file:///path/to/file.xml" /> <property name="unmarshaller" ref="stuffUnmarshaller" /> </bean> <bean id="stuffUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="com.company.project.xmlcontext"/> </bean> <bean id="stuffWriter" class="com.company.project.batch.StuffWriter" />
In case it matters, the "StuffWriter" is just a class that logs the items that would be written.
Please let me know if I've missed some important nuance involved with Batch and/or Stax.