Interface RTopic<M>

  • Type Parameters:
    M - the type of message object
    All Superinterfaces:
    RTopicAsync<M>
    All Known Implementing Classes:
    RedissonTopic

    public interface RTopic<M>
    extends RTopicAsync<M>
    Distributed topic. Messages are delivered to all message listeners across Redis cluster.
    Author:
    Nikita Koksharov
    • Method Detail

      • getChannelNames

        List<String> getChannelNames()
        Get topic channel names
        Returns:
        channel names
      • publish

        long publish​(M message)
        Publish the message to all subscribers of this topic
        Parameters:
        message - to send
        Returns:
        the number of clients that received the message
      • addListener

        int addListener​(MessageListener<M> listener)
        Subscribes to this topic. MessageListener.onMessage is called when any message is published on this topic.
        Parameters:
        listener - for messages
        Returns:
        locally unique listener id
        See Also:
        MessageListener
      • addListener

        int addListener​(StatusListener listener)
        Subscribes to status changes of this topic
        Parameters:
        listener - for messages
        Returns:
        listener id
        See Also:
        StatusListener
      • removeListener

        void removeListener​(MessageListener<?> listener)
        Removes the listener by its instance
        Parameters:
        listener - - listener instance
      • removeListener

        void removeListener​(int listenerId)
        Removes the listener by id for listening this topic
        Parameters:
        listenerId - - listener id
      • removeAllListeners

        void removeAllListeners()
        Removes all listeners from this topic