關於springbatch的一些經驗

spring.batch.job.enabled=false # 默認自動執行定義的Job(true),改成false,須要jobLaucher.run執行spring

step單節點的多線程並行執行br/>@Bean
public Step helloWorldStep(StepBuilderFactory stepBuilders) {
return stepBuilders.get("helloWorldStep")
.<City, String>chunk(100)
.reader(reader(dataSource))
.processor(processor())
.writer(writer())
.taskExecutor(new SimpleAsyncTaskExecutor())//能夠自定義線程池
.throttleLimit(8)
.build();
}多線程

斷批續跑須要在邏輯上設立某字段標記數據是否已經被處理,使用JdbcPagingItemReader續跑處理未完成的數據

若是須要多結點並行,能夠將key的集合發送到消息隊列,並設置處理狀態爲已處理
相關文章
相關標籤/搜索