Class GenericReaderEndpointRegistry<C extends PulsarMessageReaderContainer,E extends PulsarReaderEndpoint<C>>

java.lang.Object
org.springframework.pulsar.config.GenericReaderEndpointRegistry<C,E>
Type Parameters:
C - container type
E - endpoint type
All Implemented Interfaces:
EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, PulsarReaderContainerRegistry
Direct Known Subclasses:
PulsarReaderEndpointRegistry

public class GenericReaderEndpointRegistry<C extends PulsarMessageReaderContainer,E extends PulsarReaderEndpoint<C>> extends Object implements PulsarReaderContainerRegistry, org.springframework.beans.factory.DisposableBean, org.springframework.context.SmartLifecycle, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
Creates the necessary container instances for the registered endpoints. Also manages the lifecycle of the reader containers, in particular within the lifecycle of the application context.

Contrary to containers created manually, reader listener containers managed by registry are not beans in the application context and are not candidates for autowiring. Use getReaderContainers() ()} if you need to access this registry's reader listener containers for management purposes. If you need to access to a specific reader listener container, use getReaderContainer(String) with the id of the endpoint.

  • Constructor Details

    • GenericReaderEndpointRegistry

      protected GenericReaderEndpointRegistry(Class<?> type)
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • getReaderContainer

      @Nullable public C getReaderContainer(String id)
      Specified by:
      getReaderContainer in interface PulsarReaderContainerRegistry
    • getReaderContainerIds

      public Set<String> getReaderContainerIds()
      Specified by:
      getReaderContainerIds in interface PulsarReaderContainerRegistry
    • getReaderContainers

      public Collection<C> getReaderContainers()
      Specified by:
      getReaderContainers in interface PulsarReaderContainerRegistry
    • getAllReaderContainers

      public Collection<C> getAllReaderContainers()
      Specified by:
      getAllReaderContainers in interface PulsarReaderContainerRegistry
    • registerReaderContainer

      public void registerReaderContainer(E endpoint, ReaderContainerFactory<? extends C,E> factory)
    • registerReaderContainer

      public void registerReaderContainer(E endpoint, ReaderContainerFactory<? extends C,E> factory, boolean startImmediately)
    • createReaderContainer

      protected C createReaderContainer(E endpoint, ReaderContainerFactory<? extends C,E> factory)
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • stop

      public void stop(Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<C extends PulsarMessageReaderContainer>