@Bean public TaskletStep masterStep() { return this.masterStepBuilderFactory.get("masterStep") .<Integer, Integer>chunk(3) .reader(itemReader()) .outputChannel(requests()) .inputChannel(replies()) .build(); }
.reader(itemReader) .readerIsTransactionalQueue() .processor(itemProcessor)
@Test public void testMasterStepCreation() { // when TaskletStep taskletStep = new RemoteChunkingMasterStepBuilder<String, String>("step") .reader(this.itemReader) .repository(this.jobRepository) .transactionManager(this.transactionManager) .inputChannel(this.inputChannel) .outputChannel(this.outputChannel) .build(); // then Assert.assertNotNull(taskletStep); }
@Test public void testUnsupportedOperationExceptionWhenSpecifyingAnItemWriter() { // given this.expectedException.expect(UnsupportedOperationException.class); this.expectedException.expectMessage("When configuring a master " + "step for remote chunking, the item writer will be automatically " + "set to an instance of ChunkMessageChannelItemWriter. " + "The item writer must not be provided in this case."); // when TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step") .reader(this.itemReader) .writer(items -> { }) .repository(this.jobRepository) .transactionManager(this.transactionManager) .inputChannel(this.inputChannel) .outputChannel(this.outputChannel) .build(); // then // expected exception }