Package io.micronaut.pulsar
Class PulsarReaderFactory
java.lang.Object
io.micronaut.pulsar.PulsarReaderFactory
- All Implemented Interfaces:
PulsarReaderRegistry
,AutoCloseable
@Factory
public class PulsarReaderFactory
extends Object
implements AutoCloseable, PulsarReaderRegistry
Create pulsar reader beans for fields annotated with PulsarReader.
- Since:
- 1.0
- Author:
- Haris Secic
-
Constructor Summary
ConstructorDescriptionPulsarReaderFactory
(org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, TopicResolver topicResolver) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
org.apache.pulsar.client.api.Reader<?>
If not specified explicitly, reader name will default to property/field name.org.apache.pulsar.client.api.Reader<?>
getReaderByInjectionPoint
(io.micronaut.context.BeanResolutionContext context, @Nullable io.micronaut.core.annotation.AnnotationValue<PulsarReader> annotationValue, @Nullable io.micronaut.core.type.Argument<?> returnType, @Nullable io.micronaut.aop.MethodInvocationContext<?, ?> methodInvocationContext) Create Pulsar Reader for given injection point if missing.Collection<org.apache.pulsar.client.api.Reader<?>>
-
Constructor Details
-
PulsarReaderFactory
public PulsarReaderFactory(org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, TopicResolver topicResolver)
-
-
Method Details
-
getReaderByInjectionPoint
@Prototype public org.apache.pulsar.client.api.Reader<?> getReaderByInjectionPoint(io.micronaut.context.BeanResolutionContext context, @Nullable @Parameter @Nullable io.micronaut.core.annotation.AnnotationValue<PulsarReader> annotationValue, @Nullable @Parameter @Nullable io.micronaut.core.type.Argument<?> returnType, @Nullable @Parameter @Nullable io.micronaut.aop.MethodInvocationContext<?, ?> methodInvocationContext) throws org.apache.pulsar.client.api.PulsarClientExceptionCreate Pulsar Reader for given injection point if missing.- Parameters:
context
- injection point ofReader<?>
if used as injection argument.annotationValue
- method annotation value if used by annotating methodmethodInvocationContext
- method invocation context if used by annotating methodreturnType
- method return type if used by annotating method- Returns:
- new instance of Pulsar reader if missing; otherwise return from cache
- Throws:
org.apache.pulsar.client.api.PulsarClientException
- in case of not being able to create such Reader
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getReader
Description copied from interface:PulsarReaderRegistry
If not specified explicitly, reader name will default to property/field name.- Specified by:
getReader
in interfacePulsarReaderRegistry
- Parameters:
identifier
- unique identifier for a reader- Returns:
- Pulsar Reader if found for a given name
-
getReaders
- Specified by:
getReaders
in interfacePulsarReaderRegistry
- Returns:
- all registered Pulsar Readers
-