Package io.micronaut.pulsar.processor
Class PulsarConsumerProcessor
java.lang.Object
io.micronaut.pulsar.processor.PulsarConsumerProcessor
- All Implemented Interfaces:
io.micronaut.context.processor.AnnotationProcessor<PulsarConsumer,,io.micronaut.inject.ExecutableMethod<?, ?>> io.micronaut.context.processor.ExecutableMethodProcessor<PulsarConsumer>,PulsarConsumerRegistry,AutoCloseable
@Singleton
@Internal
public class PulsarConsumerProcessor
extends Object
implements io.micronaut.context.processor.ExecutableMethodProcessor<PulsarConsumer>, AutoCloseable, PulsarConsumerRegistry
Processes beans containing methods annotated with @PulsarConsumer.
- Since:
- 1.0
- Author:
- Haris Secic
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DefaultPulsarClientConfigurationprotected final TopicResolver -
Constructor Summary
ConstructorsConstructorDescriptionPulsarConsumerProcessor(io.micronaut.context.event.ApplicationEventPublisher<Object> applicationEventPublisher, io.micronaut.context.BeanContext beanContext, org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, DefaultPulsarClientConfiguration pulsarClientConfiguration, TopicResolver topicResolver) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanconsumerExists(@NonNull String id) <T> @NonNull org.apache.pulsar.client.api.Consumer<T>getConsumer(@NonNull String id) protected @NotNull StringgetConsumerName(io.micronaut.core.annotation.AnnotationValue<PulsarConsumer> topic) Resolve topic name from thePulsarConsumerannotation.booleanvoidvoidprocess(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?, ?> method) void
-
Field Details
-
topicResolver
-
pulsarClientConfiguration
-
-
Constructor Details
-
PulsarConsumerProcessor
public PulsarConsumerProcessor(io.micronaut.context.event.ApplicationEventPublisher<Object> applicationEventPublisher, io.micronaut.context.BeanContext beanContext, org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, DefaultPulsarClientConfiguration pulsarClientConfiguration, TopicResolver topicResolver)
-
-
Method Details
-
process
public void process(io.micronaut.inject.BeanDefinition<?> beanDefinition, io.micronaut.inject.ExecutableMethod<?, ?> method) - Specified by:
processin interfaceio.micronaut.context.processor.AnnotationProcessor<PulsarConsumer,io.micronaut.inject.ExecutableMethod<?, ?>> - Specified by:
processin interfaceio.micronaut.context.processor.ExecutableMethodProcessor<PulsarConsumer>
-
getConsumerName
@NotNull protected @NotNull String getConsumerName(io.micronaut.core.annotation.AnnotationValue<PulsarConsumer> topic) Resolve topic name from thePulsarConsumerannotation.- Parameters:
topic- value ofPulsarConsumerannotation- Returns:
- defined consumer name if set; otherwise generate a new one.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getConsumers
- Specified by:
getConsumersin interfacePulsarConsumerRegistry
-
getConsumer
@NonNull public <T> @NonNull org.apache.pulsar.client.api.Consumer<T> getConsumer(@NonNull @NonNull String id) - Specified by:
getConsumerin interfacePulsarConsumerRegistry
-
consumerExists
- Specified by:
consumerExistsin interfacePulsarConsumerRegistry
-
getConsumerIds
- Specified by:
getConsumerIdsin interfacePulsarConsumerRegistry
-
isPaused
- Specified by:
isPausedin interfacePulsarConsumerRegistry
-
pause
- Specified by:
pausein interfacePulsarConsumerRegistry
-
resume
- Specified by:
resumein interfacePulsarConsumerRegistry
-