Class PubSubEndpoint<K,​V>

    • Constructor Detail

      • PubSubEndpoint

        public PubSubEndpoint​(ClientOptions clientOptions,
                              ClientResources clientResources)
        Initialize a new instance that handles commands from the supplied queue.
        Parameters:
        clientOptions - client options for this connection, must not be null
        clientResources - client resources for this connection, must not be null.
    • Method Detail

      • addListener

        public void addListener​(RedisPubSubListener<K,​V> listener)
        Add a new listener.
        Parameters:
        listener - the listener, must not be null.
      • removeListener

        public void removeListener​(RedisPubSubListener<K,​V> listener)
        Remove an existing listener.
        Parameters:
        listener - the listener, must not be null.
      • hasChannelSubscriptions

        public boolean hasChannelSubscriptions()
      • getChannels

        public Set<K> getChannels()
      • hasPatternSubscriptions

        public boolean hasPatternSubscriptions()
      • getPatterns

        public Set<K> getPatterns()
      • write

        public <K1,​V1,​T> RedisCommand<K1,​V1,​T> write​(RedisCommand<K1,​V1,​T> command)
        Description copied from interface: RedisChannelWriter
        Write a command on the channel. The command may be changed/wrapped during write and the written instance is returned after the call.
        Specified by:
        write in interface RedisChannelWriter
        Overrides:
        write in class DefaultEndpoint
        T - result type
        Parameters:
        command - the Redis command.
        Returns:
        the written Redis command.
      • write

        public <K1,​V1> Collection<RedisCommand<K1,​V1,​?>> write​(Collection<? extends RedisCommand<K1,​V1,​?>> redisCommands)
        Description copied from interface: RedisChannelWriter
        Write multiple commands on the channel. The commands may be changed/wrapped during write and the written instance is returned after the call.
        Specified by:
        write in interface RedisChannelWriter
        Overrides:
        write in class DefaultEndpoint
        Type Parameters:
        K1 - key type
        V1 - value type
        Parameters:
        redisCommands - the Redis commands.
        Returns:
        the written redis command
      • rejectCommand

        protected void rejectCommand​(RedisCommand<?,​?,​?> command)
      • rejectCommands

        protected void rejectCommands​(Collection<? extends RedisCommand<?,​?,​?>> redisCommands)
      • containsViolatingCommands

        protected boolean containsViolatingCommands​(Collection<? extends RedisCommand<?,​?,​?>> redisCommands)
      • isSubscribed

        public boolean isSubscribed()
      • notifyListeners

        protected void notifyListeners​(PubSubMessage<K,​V> message)