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
Modifier and TypeFieldDescriptionprotected final DefaultPulsarClientConfiguration
protected final TopicResolver
-
Constructor Summary
ConstructorDescriptionPulsarConsumerProcessor
(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 TypeMethodDescriptionvoid
close()
boolean
consumerExists
(@NonNull String id) <T> @NonNull org.apache.pulsar.client.api.Consumer<T>
getConsumer
(@NonNull String id) protected @NotNull String
getConsumerName
(io.micronaut.core.annotation.AnnotationValue<PulsarConsumer> topic) Resolve topic name from thePulsarConsumer
annotation.boolean
void
void
process
(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:
process
in interfaceio.micronaut.context.processor.AnnotationProcessor<PulsarConsumer,
io.micronaut.inject.ExecutableMethod<?, ?>> - Specified by:
process
in interfaceio.micronaut.context.processor.ExecutableMethodProcessor<PulsarConsumer>
-
getConsumerName
@NotNull protected @NotNull String getConsumerName(io.micronaut.core.annotation.AnnotationValue<PulsarConsumer> topic) Resolve topic name from thePulsarConsumer
annotation.- Parameters:
topic
- value ofPulsarConsumer
annotation- Returns:
- defined consumer name if set; otherwise generate a new one.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getConsumers
- Specified by:
getConsumers
in interfacePulsarConsumerRegistry
-
getConsumer
@NonNull public <T> @NonNull org.apache.pulsar.client.api.Consumer<T> getConsumer(@NonNull @NonNull String id) - Specified by:
getConsumer
in interfacePulsarConsumerRegistry
-
consumerExists
- Specified by:
consumerExists
in interfacePulsarConsumerRegistry
-
getConsumerIds
- Specified by:
getConsumerIds
in interfacePulsarConsumerRegistry
-
isPaused
- Specified by:
isPaused
in interfacePulsarConsumerRegistry
-
pause
- Specified by:
pause
in interfacePulsarConsumerRegistry
-
resume
- Specified by:
resume
in interfacePulsarConsumerRegistry
-