org.springframework.batch.core.ItemReadListener Java Examples

The following examples show how to use org.springframework.batch.core.ItemReadListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskBatchEventListenerBeanPostProcessorTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@Before
public void setupMock() {
	when(this.taskletStep.getTasklet()).thenReturn(
			new ChunkOrientedTasklet(this.chunkProvider, this.chunkProcessor));
	when(this.taskletStep.getName()).thenReturn("FOOOBAR");

	registerAlias(ItemProcessListener.class,
			BatchEventAutoConfiguration.ITEM_PROCESS_EVENTS_LISTENER);
	registerAlias(StepExecutionListener.class,
			BatchEventAutoConfiguration.STEP_EXECUTION_EVENTS_LISTENER);
	registerAlias(ChunkListener.class,
			BatchEventAutoConfiguration.CHUNK_EVENTS_LISTENER);
	registerAlias(ItemReadListener.class,
			BatchEventAutoConfiguration.ITEM_READ_EVENTS_LISTENER);
	registerAlias(ItemWriteListener.class,
			BatchEventAutoConfiguration.ITEM_WRITE_EVENTS_LISTENER);
	registerAlias(SkipListener.class,
			BatchEventAutoConfiguration.SKIP_EVENTS_LISTENER);
}
 
Example #2
Source File: BatchEventAutoConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnProperty(prefix = "spring.cloud.task.batch.events.item-read",
		name = "enabled", havingValue = "true", matchIfMissing = true)
// @checkstyle:on
public ItemReadListener itemReadEventsListener() {
	return new EventEmittingItemReadListener(
			this.listenerChannels.itemReadEvents(),
			this.taskEventProperties.getItemReadOrder());
}
 
Example #3
Source File: TaskBatchEventListenerBeanPostProcessor.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
private void registerItemReadEvents(SimpleChunkProvider chunkProvider) {
	if (this.applicationContext
			.containsBean(BatchEventAutoConfiguration.ITEM_READ_EVENTS_LISTENER)) {
		chunkProvider.registerListener((ItemReadListener) this.applicationContext
				.getBean(BatchEventAutoConfiguration.ITEM_READ_EVENTS_LISTENER));
	}
}