Class RedisPubSubListenerRegistry

java.lang.Object
io.micronaut.configuration.lettuce.pubsub.RedisPubSubListenerRegistry
All Implemented Interfaces:
io.micronaut.runtime.graceful.GracefulShutdownCapable, AutoCloseable

@Singleton @Requires(beans=AbstractRedisConfiguration.class) public class RedisPubSubListenerRegistry extends Object implements AutoCloseable, io.micronaut.runtime.graceful.GracefulShutdownCapable
Manages Redis Pub/Sub listener registrations.
Since:
7.0
Author:
Graeme Rocher
  • Constructor Details

    • RedisPubSubListenerRegistry

      public RedisPubSubListenerRegistry(io.micronaut.context.BeanLocator beanLocator)
      Parameters:
      beanLocator - The bean locator
  • Method Details

    • subscribe

      public void subscribe(@Nullable String connectionName, Set<RedisPubSubListenerRegistry.ChannelSubscription> subscriptions, ExecutorService executor, Consumer<RedisMessage> consumer)
      Register a listener handler for the given channel subscriptions.
      Parameters:
      connectionName - The optional connection name
      subscriptions - The subscriptions
      executor - The executor to invoke the listener on
      consumer - The listener callback
    • shutdownGracefully

      public CompletionStage<?> shutdownGracefully()
      Specified by:
      shutdownGracefully in interface io.micronaut.runtime.graceful.GracefulShutdownCapable
    • reportActiveTasks

      public OptionalLong reportActiveTasks()
      Specified by:
      reportActiveTasks in interface io.micronaut.runtime.graceful.GracefulShutdownCapable
    • close

      @PreDestroy public void close()
      Specified by:
      close in interface AutoCloseable