Added ConditionalOnProperty for batch event listeners

Resolves spring-cloud/spring-cloud-task#130
This commit is contained in:
Glenn Renfro
2016-05-02 14:29:54 -04:00
parent 5c0a83dd4f
commit fc3dcffe4b
2 changed files with 108 additions and 9 deletions

View File

@@ -82,17 +82,20 @@ public class BatchEventAutoConfiguration {
@Bean
@Lazy
@ConditionalOnProperty(prefix = "spring.cloud.task.events.job.execution.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public JobExecutionListener jobExecutionEventsListener() {
return new EventEmittingJobExecutionListener(listenerChannels.jobExecutionEvents());
}
@Bean
@ConditionalOnProperty(prefix = "spring.cloud.task.events.step.execution.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public StepExecutionListener stepExecutionEventsListener() {
return new EventEmittingStepExecutionListener(listenerChannels.stepExecutionEvents());
}
@Bean
@Lazy
@ConditionalOnProperty(prefix = "spring.cloud.task.events.chunk.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public GatewayProxyFactoryBean chunkEventsListener() {
GatewayProxyFactoryBean factoryBean =
new GatewayProxyFactoryBean(ChunkListener.class);
@@ -103,21 +106,25 @@ public class BatchEventAutoConfiguration {
}
@Bean
@ConditionalOnProperty(prefix = "spring.cloud.task.events.item.read.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public ItemReadListener itemReadEventsListener() {
return new EventEmittingItemReadListener(listenerChannels.itemReadEvents());
}
@Bean
@ConditionalOnProperty(prefix = "spring.cloud.task.events.item.write.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public ItemWriteListener itemWriteEventsListener() {
return new EventEmittingItemWriteListener(listenerChannels.itemWriteEvents());
}
@Bean
@ConditionalOnProperty(prefix = "spring.cloud.task.events.item.process.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public ItemProcessListener itemProcessEventsListener() {
return new EventEmittingItemProcessListener(listenerChannels.itemProcessEvents());
}
@Bean
@ConditionalOnProperty(prefix = "spring.cloud.task.events.skip.events.listener", name = "enabled", havingValue = "true", matchIfMissing = true)
public SkipListener skipEventsListener() {
return new EventEmittingSkipListener(listenerChannels.skipEvents());
}