Interface PubSubCommands<V>

    • Method Detail

      • publish

        void publish​(String channel,
                     V message)
        Publishes a message to a given channel
        Parameters:
        channel - the channel
        message - the message
      • subscribe

        PubSubCommands.RedisSubscriber subscribe​(String channel,
                                                 Consumer<V> onMessage)
        Subscribes to a given channel.
        Parameters:
        channel - the channel
        onMessage - the message consumer. Be aware that this callback is invoked for each message sent to the given channel, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.
        Returns:
        the subscriber object that lets you unsubscribe
      • subscribeToPattern

        PubSubCommands.RedisSubscriber subscribeToPattern​(String pattern,
                                                          Consumer<V> onMessage)
        Subscribes to a given pattern like chan*l.
        Parameters:
        pattern - the pattern
        onMessage - the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.
        Returns:
        the subscriber object that lets you unsubscribe
      • subscribeToPatterns

        PubSubCommands.RedisSubscriber subscribeToPatterns​(List<String> patterns,
                                                           Consumer<V> onMessage)
        Subscribes to the given patterns like chan*l.
        Parameters:
        patterns - the patterns
        onMessage - the message consumer. Be aware that this callback is invoked for each message sent to the channels matching the pattern, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.
        Returns:
        the subscriber object that lets you unsubscribe
      • subscribe

        PubSubCommands.RedisSubscriber subscribe​(List<String> channels,
                                                 Consumer<V> onMessage)
        Subscribes to the given channels.
        Parameters:
        channels - the channels
        onMessage - the message consumer. Be aware that this callback is invoked for each message sent to the given channels, and is invoked on the I/O thread. So, you must not block. Offload to a separate thread if needed.
        Returns:
        the subscriber object that lets you unsubscribe