@Singleton @Requires(beans=KafkaDefaultConfiguration.class) public class KafkaConsumerProcessor extends java.lang.Object implements io.micronaut.context.processor.ExecutableMethodProcessor<KafkaListener>, java.lang.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(java.util.concurrent.ExecutorService executorService,
io.micronaut.runtime.ApplicationConfiguration applicationConfiguration,
io.micronaut.context.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(io.micronaut.inject.BeanDefinition<?> beanDefinition,
io.micronaut.inject.ExecutableMethod<?,?> method) |
public KafkaConsumerProcessor(@Named(value="consumer") java.util.concurrent.ExecutorService executorService, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.context.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(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?,?> method)
process
in interface io.micronaut.context.processor.AnnotationProcessor<KafkaListener,io.micronaut.inject.ExecutableMethod<?,?>>
process
in interface io.micronaut.context.processor.ExecutableMethodProcessor<KafkaListener>
@PreDestroy public void close()
close
in interface java.lang.AutoCloseable