Class SubscriberHandler


public class SubscriberHandler extends CacheRespRequestHandler
  • Constructor Details

  • Method Details

    • newKeyListener

      public static RespCacheListener newKeyListener(io.netty.channel.Channel channel, byte[] key)
    • newPatternListener

      public static RespCacheListener newPatternListener(io.netty.channel.Channel channel, byte[] pattern)
    • specificChannelSubscribers

      public Map<WrappedByteArray,RespCacheListener> specificChannelSubscribers()
    • resp3Handler

      public Resp3Handler resp3Handler()
    • handleChannelDisconnect

      public void handleChannelDisconnect(io.netty.channel.ChannelHandlerContext ctx)
      Overrides:
      handleChannelDisconnect in class RespRequestHandler
    • actualHandleRequest

      protected CompletionStage<RespRequestHandler> actualHandleRequest(io.netty.channel.ChannelHandlerContext ctx, RespCommand command, List<byte[]> arguments)
      Description copied from class: RespRequestHandler
      Handles the RESP request returning a stage that when complete notifies the command has completed as well as providing the request handler for subsequent commands.

      Implementations should never use the ByteBufAllocator in the context. Instead, they should use RespRequestHandler.writer to retrieve a ResponseWriter This ByteBuffer should only have bytes written to it adding up to the size requested. The ByteBuffer itself should never be written to the context or channel and flush should also never be invoked. Failure to do so may cause mis-ordering or responses as requests support pipelining and a ByteBuf may not be sent down stream until later in the pipeline.

      Overrides:
      actualHandleRequest in class RespRequestHandler
      Parameters:
      ctx - Netty context pipeline for this request
      command - The command type
      arguments - The remaining arguments to the command
      Returns:
      stage that when complete returns the new handler to instate. This stage must be completed on the event loop
    • handleStageListenerError

      public CompletionStage<Void> handleStageListenerError(CompletionStage<Void> stage, byte[] keyChannel, boolean subscribeOrUnsubscribe)
    • removeAllListeners

      public void removeAllListeners()
    • unsubscribeAll

      public CompletionStage<RespRequestHandler> unsubscribeAll(io.netty.channel.ChannelHandlerContext ctx)
    • sendSubscriptions

      public CompletionStage<RespRequestHandler> sendSubscriptions(io.netty.channel.ChannelHandlerContext ctx, CompletionStage<Void> stageToWaitFor, Collection<byte[]> keyChannels, boolean isSubscribe)