@Singleton public class RabbitMQConsumerAdvice extends Object implements io.micronaut.context.processor.ExecutableMethodProcessor<RabbitListener>, AutoCloseable
ExecutableMethodProcessor
that will process all beans annotated
with RabbitListener
and create and subscribe the relevant methods
as consumers to RabbitMQ queues.Constructor and Description |
---|
RabbitMQConsumerAdvice(io.micronaut.context.BeanContext beanContext,
RabbitBinderRegistry binderRegistry,
RabbitListenerExceptionHandler exceptionHandler,
RabbitMessageSerDesRegistry serDesRegistry,
io.micronaut.core.convert.ConversionService conversionService)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected com.rabbitmq.client.Channel |
getChannel(ChannelPool channelPool)
Retrieves a channel to use for consuming messages.
|
void |
process(io.micronaut.inject.BeanDefinition<?> beanDefinition,
io.micronaut.inject.ExecutableMethod<?,?> method) |
public RabbitMQConsumerAdvice(io.micronaut.context.BeanContext beanContext, RabbitBinderRegistry binderRegistry, RabbitListenerExceptionHandler exceptionHandler, RabbitMessageSerDesRegistry serDesRegistry, io.micronaut.core.convert.ConversionService conversionService)
beanContext
- The bean contextbinderRegistry
- The registry to bind arguments to the methodexceptionHandler
- The exception handler to use if the consumer isn't a handlerserDesRegistry
- The serialization/deserialization registryconversionService
- The service to convert consume argument valuespublic void process(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?,?> method)
process
in interface io.micronaut.context.processor.AnnotationProcessor<RabbitListener,io.micronaut.inject.ExecutableMethod<?,?>>
process
in interface io.micronaut.context.processor.ExecutableMethodProcessor<RabbitListener>
@PreDestroy public void close() throws Exception
close
in interface AutoCloseable
Exception
protected com.rabbitmq.client.Channel getChannel(ChannelPool channelPool)
channelPool
- The channel pool to retrieve the channel from