|
|
|
@ -29,6 +29,7 @@ import org.springframework.kafka.core.ConsumerFactory; |
|
|
|
import org.springframework.kafka.core.DefaultKafkaConsumerFactory; |
|
|
|
import org.springframework.kafka.core.DefaultKafkaConsumerFactory; |
|
|
|
import org.springframework.kafka.core.KafkaTemplate; |
|
|
|
import org.springframework.kafka.core.KafkaTemplate; |
|
|
|
import org.springframework.kafka.listener.AfterRollbackProcessor; |
|
|
|
import org.springframework.kafka.listener.AfterRollbackProcessor; |
|
|
|
|
|
|
|
import org.springframework.kafka.listener.BatchInterceptor; |
|
|
|
import org.springframework.kafka.listener.CommonErrorHandler; |
|
|
|
import org.springframework.kafka.listener.CommonErrorHandler; |
|
|
|
import org.springframework.kafka.listener.ConsumerAwareRebalanceListener; |
|
|
|
import org.springframework.kafka.listener.ConsumerAwareRebalanceListener; |
|
|
|
import org.springframework.kafka.listener.RecordInterceptor; |
|
|
|
import org.springframework.kafka.listener.RecordInterceptor; |
|
|
|
@ -44,6 +45,7 @@ import org.springframework.kafka.transaction.KafkaAwareTransactionManager; |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Gary Russell |
|
|
|
* @author Gary Russell |
|
|
|
* @author Eddú Meléndez |
|
|
|
* @author Eddú Meléndez |
|
|
|
|
|
|
|
* @author Thomas Kåsene |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
@ConditionalOnClass(EnableKafka.class) |
|
|
|
@ConditionalOnClass(EnableKafka.class) |
|
|
|
@ -69,6 +71,8 @@ class KafkaAnnotationDrivenConfiguration { |
|
|
|
|
|
|
|
|
|
|
|
private final RecordInterceptor<Object, Object> recordInterceptor; |
|
|
|
private final RecordInterceptor<Object, Object> recordInterceptor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final BatchInterceptor<Object, Object> batchInterceptor; |
|
|
|
|
|
|
|
|
|
|
|
KafkaAnnotationDrivenConfiguration(KafkaProperties properties, |
|
|
|
KafkaAnnotationDrivenConfiguration(KafkaProperties properties, |
|
|
|
ObjectProvider<RecordMessageConverter> messageConverter, |
|
|
|
ObjectProvider<RecordMessageConverter> messageConverter, |
|
|
|
ObjectProvider<RecordFilterStrategy<Object, Object>> recordFilterStrategy, |
|
|
|
ObjectProvider<RecordFilterStrategy<Object, Object>> recordFilterStrategy, |
|
|
|
@ -78,7 +82,8 @@ class KafkaAnnotationDrivenConfiguration { |
|
|
|
ObjectProvider<ConsumerAwareRebalanceListener> rebalanceListener, |
|
|
|
ObjectProvider<ConsumerAwareRebalanceListener> rebalanceListener, |
|
|
|
ObjectProvider<CommonErrorHandler> commonErrorHandler, |
|
|
|
ObjectProvider<CommonErrorHandler> commonErrorHandler, |
|
|
|
ObjectProvider<AfterRollbackProcessor<Object, Object>> afterRollbackProcessor, |
|
|
|
ObjectProvider<AfterRollbackProcessor<Object, Object>> afterRollbackProcessor, |
|
|
|
ObjectProvider<RecordInterceptor<Object, Object>> recordInterceptor) { |
|
|
|
ObjectProvider<RecordInterceptor<Object, Object>> recordInterceptor, |
|
|
|
|
|
|
|
ObjectProvider<BatchInterceptor<Object, Object>> batchInterceptor) { |
|
|
|
this.properties = properties; |
|
|
|
this.properties = properties; |
|
|
|
this.messageConverter = messageConverter.getIfUnique(); |
|
|
|
this.messageConverter = messageConverter.getIfUnique(); |
|
|
|
this.recordFilterStrategy = recordFilterStrategy.getIfUnique(); |
|
|
|
this.recordFilterStrategy = recordFilterStrategy.getIfUnique(); |
|
|
|
@ -90,6 +95,7 @@ class KafkaAnnotationDrivenConfiguration { |
|
|
|
this.commonErrorHandler = commonErrorHandler.getIfUnique(); |
|
|
|
this.commonErrorHandler = commonErrorHandler.getIfUnique(); |
|
|
|
this.afterRollbackProcessor = afterRollbackProcessor.getIfUnique(); |
|
|
|
this.afterRollbackProcessor = afterRollbackProcessor.getIfUnique(); |
|
|
|
this.recordInterceptor = recordInterceptor.getIfUnique(); |
|
|
|
this.recordInterceptor = recordInterceptor.getIfUnique(); |
|
|
|
|
|
|
|
this.batchInterceptor = batchInterceptor.getIfUnique(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
@Bean |
|
|
|
@ -107,6 +113,7 @@ class KafkaAnnotationDrivenConfiguration { |
|
|
|
configurer.setCommonErrorHandler(this.commonErrorHandler); |
|
|
|
configurer.setCommonErrorHandler(this.commonErrorHandler); |
|
|
|
configurer.setAfterRollbackProcessor(this.afterRollbackProcessor); |
|
|
|
configurer.setAfterRollbackProcessor(this.afterRollbackProcessor); |
|
|
|
configurer.setRecordInterceptor(this.recordInterceptor); |
|
|
|
configurer.setRecordInterceptor(this.recordInterceptor); |
|
|
|
|
|
|
|
configurer.setBatchInterceptor(this.batchInterceptor); |
|
|
|
return configurer; |
|
|
|
return configurer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|