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

    Constructors
    Constructor
    Description
    PulsarReaderFactory(org.apache.pulsar.client.api.PulsarClient pulsarClient, DefaultSchemaHandler simpleSchemaResolver, TopicResolver topicResolver)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    org.apache.pulsar.client.api.Reader<?>
    getReader(String identifier)
    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<?>>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.PulsarClientException
      Create Pulsar Reader for given injection point if missing.
      Parameters:
      context - injection point of Reader<?> if used as injection argument.
      annotationValue - method annotation value if used by annotating method
      methodInvocationContext - method invocation context if used by annotating method
      returnType - 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 interface AutoCloseable
    • getReader

      public org.apache.pulsar.client.api.Reader<?> getReader(String identifier)
      Description copied from interface: PulsarReaderRegistry
      If not specified explicitly, reader name will default to property/field name.
      Specified by:
      getReader in interface PulsarReaderRegistry
      Parameters:
      identifier - unique identifier for a reader
      Returns:
      Pulsar Reader if found for a given name
    • getReaders

      public Collection<org.apache.pulsar.client.api.Reader<?>> getReaders()
      Specified by:
      getReaders in interface PulsarReaderRegistry
      Returns:
      all registered Pulsar Readers