List of usage examples for org.springframework.batch.item.support PassThroughItemProcessor PassThroughItemProcessor
PassThroughItemProcessor
From source file:es.fcs.batch.integration.chunk.MyRemoteChunkHandlerFactoryBean.java
/** * Replace the chunk processor in the tasklet provided with one that can act as a master in the Remote Chunking * pattern.// ww w. j a va2s .c o m * * @param tasklet a ChunkOrientedTasklet * @param chunkWriter an ItemWriter that can send the chunks to remote workers * @param stepContributionSource a StepContributionSource used to gather results from the workers */ private void replaceChunkProcessor(ChunkOrientedTasklet<?> tasklet, ItemWriter<T> chunkWriter, final StepContributionSource stepContributionSource) { setField(tasklet, "chunkProcessor", new SimpleChunkProcessor<T, T>(new PassThroughItemProcessor<T>(), chunkWriter) { /** * */ private static final long serialVersionUID = -8914556774351841413L; @Override protected void write(StepContribution contribution, Chunk<T> inputs, Chunk<T> outputs) throws Exception { doWrite(outputs.getItems()); // Do not update the step contribution until the chunks are // actually processed updateStepContribution(contribution, stepContributionSource); } }); }
From source file:org.springframework.batch.integration.chunk.RemoteChunkHandlerFactoryBean.java
/** * Replace the chunk processor in the tasklet provided with one that can act as a master in the Remote Chunking * pattern./*from w ww. j a v a 2 s. c om*/ * * @param tasklet a ChunkOrientedTasklet * @param chunkWriter an ItemWriter that can send the chunks to remote workers * @param stepContributionSource a StepContributionSource used to gather results from the workers */ private void replaceChunkProcessor(ChunkOrientedTasklet<?> tasklet, ItemWriter<T> chunkWriter, final StepContributionSource stepContributionSource) { setField(tasklet, "chunkProcessor", new SimpleChunkProcessor<T, T>(new PassThroughItemProcessor<T>(), chunkWriter) { @Override protected void write(StepContribution contribution, Chunk<T> inputs, Chunk<T> outputs) throws Exception { doWrite(outputs.getItems()); // Do not update the step contribution until the chunks are // actually processed updateStepContribution(contribution, stepContributionSource); } }); }