我想在批处理执行结束时生成摘要报告。
例如:我有一个ItemProcessor,它接收accountId。
for every accountId: get MarketplaceId's for every marketplaceId: call real time availability
在批处理执行结束时,我需要在一个文件中提供一个很好的摘要,该文件显示,
问题
如果您提供任何指示,那将真的很棒。
谢谢。
编写一个小任务以准备好夏天,并将该小任务作为工作的最后一步
<step id="summeryFile" >
<tasklet ref="summaryFilePreparationTasklet"/>
</step>
并且Bean配置为
<bean id="summaryFilePreparationTasklet" class="com.baji.batch.SummaryPreparationFile">
和类文件是
package com.baji.batch;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
/**
* @Author
* Bhaji Shaik
* May 30, 2015
*/
public class SummaryPreparationFile implements Tasklet {
@Autowired
private Holder holder;
@Override
public RepeatStatus execute(StepContribution arg0, ChunkContext chunkContext) throws Exception {
holder.getResults1();
//Write your own code to Prepare a neat summary preparation File
return null;
}
}
持有人类别为
import org.springframework.stereotype.Component;
@Component
public class Holder {
private List<Integer> results1;
private List<Integer> results2;
//Setter and getter methods
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句