My batch job doesn't process all read records.
After finish the job, Spring Batch logs that read 198282 records, but in processor I have a log before start the processing and logged only 196503 , but sometimes, the processor process all.
I'm running the job in multi thread with throttle limit = 20, but sometimes I have this problems, not process all.
ItemReader: JpaPagingItemReader with saveState = false
ItemProcessor:
class MyProcessor implements ItemProcessor<Item, Item> {
@Override
public Item process(final Item item) {
log.info("action=process..");
....
}
}
What could be happening? Spring batch is not sending all records to process or I'm doing something wrong to work with multi thread?
Job
@Bean
public Job myJob (Step myStep) {
return jobBuilderFactory.get("myJob")
.start(myStep)
.build();
}
Step
@Bean
public Step consolidateTaxaRebateJobStep (
JpaPagingItemReader<Item> reader,
ItemProcessor<Item, Item> processor,
ItemWriter<Item> writer,
TaskExecutor taskExecutor) {
return stepBuilderFactory.get("myStep")
.<Item, Item>chunk(200)
.reader(reader)
.processor(processor)
.writer(writer)
.taskExecutor(taskExecutor)
.throttleLimit(20)
.build();
}
Spring Boot Version: 2.0.1
问题是我有一个异常侦听器,当某些记录抛出异常时,该块中的所有记录都会被跳过。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.