@Singleton @Requires(beans=KafkaDefaultConfiguration.class) public class KafkaConsumerProcessor extends Object implements ExecutableMethodProcessor<KafkaListener>, AutoCloseable
A ExecutableMethodProcessor
that will process all beans annotated with KafkaListener
and create and subscribe the relevant methods as consumers to Kafka topics.
Constructor and Description |
---|
KafkaConsumerProcessor(ExecutorService executorService,
ApplicationConfiguration applicationConfiguration,
BeanContext beanContext,
AbstractKafkaConsumerConfiguration defaultConsumerConfiguration,
ConsumerRecordBinderRegistry binderRegistry,
BatchConsumerRecordsBinderRegistry batchBinderRegistry,
SerdeRegistry serdeRegistry,
KafkaProducerRegistry producerRegistry,
KafkaListenerExceptionHandler exceptionHandler)
Creates a new processor using the given
ExecutorService to schedule consumers on. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
process(BeanDefinition<?> beanDefinition,
ExecutableMethod<?,?> method)
The process method will be called for every
ExecutableMethod that is annotated with the type parameter A. |
public KafkaConsumerProcessor(@Named(value="consumer") ExecutorService executorService, ApplicationConfiguration applicationConfiguration, BeanContext beanContext, AbstractKafkaConsumerConfiguration defaultConsumerConfiguration, ConsumerRecordBinderRegistry binderRegistry, BatchConsumerRecordsBinderRegistry batchBinderRegistry, SerdeRegistry serdeRegistry, KafkaProducerRegistry producerRegistry, KafkaListenerExceptionHandler exceptionHandler)
ExecutorService
to schedule consumers on.executorService
- The executor serviceapplicationConfiguration
- The application configurationbeanContext
- The bean contextdefaultConsumerConfiguration
- The default consumer configbinderRegistry
- The ConsumerRecordBinderRegistry
batchBinderRegistry
- The BatchConsumerRecordsBinderRegistry
serdeRegistry
- The Serde
registryproducerRegistry
- The KafkaProducerRegistry
exceptionHandler
- The exception handler to usepublic void process(BeanDefinition<?> beanDefinition, ExecutableMethod<?,?> method)
ExecutableMethodProcessor
ExecutableMethod
that is annotated with the type parameter A.process
in interface AnnotationProcessor<KafkaListener,ExecutableMethod<?,?>>
process
in interface ExecutableMethodProcessor<KafkaListener>
beanDefinition
- The bean definition to processmethod
- The executable method@PreDestroy public void close()
close
in interface AutoCloseable