Package io.micronaut.pulsar.intercept
Class PulsarMultitenantProducerAdvice
java.lang.Object
io.micronaut.pulsar.intercept.PulsarProducerAdvice
io.micronaut.pulsar.intercept.PulsarMultitenantProducerAdvice
- All Implemented Interfaces:
io.micronaut.aop.Interceptor<Object,
,Object> io.micronaut.aop.MethodInterceptor<Object,
,Object> io.micronaut.core.order.Ordered
,PulsarProducerRegistry
,AutoCloseable
@InterceptorBean(PulsarProducerClient.class)
@Replaces(PulsarProducerAdvice.class)
public final class PulsarMultitenantProducerAdvice
extends PulsarProducerAdvice
implements io.micronaut.aop.MethodInterceptor<Object,Object>, AutoCloseable
Intercepting pulsar
Producer
methods. It can be used for creating implementation of interface methods or
just to add producer behaviour to existing methods.- Since:
- 1.0
- Author:
- Haris Secic
-
Field Summary
Fields inherited from class io.micronaut.pulsar.intercept.PulsarProducerAdvice
applicationEventPublisher, beanContext, conversionService, producers, pulsarClient, simpleSchemaResolver
Fields inherited from interface io.micronaut.aop.Interceptor
ARGUMENT, CACHEABLE_LAZY_TARGET, HOTSWAP, LAZY, PROXY_TARGET
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionPulsarMultitenantProducerAdvice
(org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, io.micronaut.context.BeanContext beanContext, io.micronaut.context.event.ApplicationEventPublisher<ProducerSubscriptionFailedEvent> applicationEventPublisher, TopicResolver topicResolver, io.micronaut.core.convert.ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected org.apache.pulsar.client.api.Producer<?>
getOrCreateProducer
(io.micronaut.inject.ExecutableMethod<?, ?> method, io.micronaut.core.annotation.AnnotationValue<PulsarProducer> annotationValue) Fetch existing producer or generate a new one via factory if missing.org.apache.pulsar.client.api.Producer<?>
getProducer
(@NonNull String id) Get single managed producer by its name.Get all managed producer identifiers.Get all managed producers.Methods inherited from class io.micronaut.pulsar.intercept.PulsarProducerAdvice
intercept
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.aop.MethodInterceptor
intercept, intercept
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Constructor Details
-
PulsarMultitenantProducerAdvice
public PulsarMultitenantProducerAdvice(org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, io.micronaut.context.BeanContext beanContext, io.micronaut.context.event.ApplicationEventPublisher<ProducerSubscriptionFailedEvent> applicationEventPublisher, TopicResolver topicResolver, io.micronaut.core.convert.ConversionService conversionService)
-
-
Method Details
-
getOrCreateProducer
protected org.apache.pulsar.client.api.Producer<?> getOrCreateProducer(io.micronaut.inject.ExecutableMethod<?, ?> method, io.micronaut.core.annotation.AnnotationValue<PulsarProducer> annotationValue) Description copied from class:PulsarProducerAdvice
Fetch existing producer or generate a new one via factory if missing.- Overrides:
getOrCreateProducer
in classPulsarProducerAdvice
- Parameters:
method
- method annotated withPulsarProducer
annotationValue
-PulsarProducer
value- Returns:
- existing producer if exists; otherwise create a new one
-
close
@PreDestroy public void close()- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classPulsarProducerAdvice
-
getProducers
Description copied from interface:PulsarProducerRegistry
Get all managed producers.- Specified by:
getProducers
in interfacePulsarProducerRegistry
- Overrides:
getProducers
in classPulsarProducerAdvice
- Returns:
- List of managed producers.
-
getProducer
Description copied from interface:PulsarProducerRegistry
Get single managed producer by its name.- Specified by:
getProducer
in interfacePulsarProducerRegistry
- Overrides:
getProducer
in classPulsarProducerAdvice
- Parameters:
id
- unique identifier- Returns:
- Pulsar producer by given name
-
getProducerIds
Description copied from interface:PulsarProducerRegistry
Get all managed producer identifiers.- Specified by:
getProducerIds
in interfacePulsarProducerRegistry
- Overrides:
getProducerIds
in classPulsarProducerAdvice
- Returns:
- List of producer names representing their identifiers in registry.
-