Package org.redisson

Class RedissonTopic<M>

  • Type Parameters:
    M - message
    All Implemented Interfaces:
    RTopic<M>, RTopicAsync<M>

    public class RedissonTopic<M>
    extends Object
    implements RTopic<M>
    Distributed topic implementation. Messages are delivered to all message listeners across Redis cluster.
    Author:
    Nikita Koksharov
    • Method Detail

      • getChannelNames

        public List<String> getChannelNames()
        Description copied from interface: RTopic
        Get topic channel names
        Specified by:
        getChannelNames in interface RTopic<M>
        Returns:
        channel names
      • publish

        public long publish​(M message)
        Description copied from interface: RTopic
        Publish the message to all subscribers of this topic
        Specified by:
        publish in interface RTopic<M>
        Parameters:
        message - to send
        Returns:
        the number of clients that received the message
      • publishAsync

        public RFuture<Long> publishAsync​(M message)
        Description copied from interface: RTopicAsync
        Publish the message to all subscribers of this topic asynchronously
        Specified by:
        publishAsync in interface RTopicAsync<M>
        Parameters:
        message - to send
        Returns:
        number of clients that received the message
      • encode

        protected io.netty.buffer.ByteBuf encode​(Object value)
      • addListener

        public int addListener​(StatusListener listener)
        Description copied from interface: RTopic
        Subscribes to status changes of this topic
        Specified by:
        addListener in interface RTopic<M>
        Parameters:
        listener - for messages
        Returns:
        listener id
        See Also:
        StatusListener
      • addListener

        public int addListener​(MessageListener<M> listener)
        Description copied from interface: RTopic
        Subscribes to this topic. MessageListener.onMessage is called when any message is published on this topic.
        Specified by:
        addListener in interface RTopic<M>
        Parameters:
        listener - for messages
        Returns:
        locally unique listener id
        See Also:
        MessageListener
      • removeAllListeners

        public void removeAllListeners()
        Description copied from interface: RTopic
        Removes all listeners from this topic
        Specified by:
        removeAllListeners in interface RTopic<M>
      • removeListener

        public void removeListener​(MessageListener<?> listener)
        Description copied from interface: RTopic
        Removes the listener by its instance
        Specified by:
        removeListener in interface RTopic<M>
        Parameters:
        listener - - listener instance
      • removeListener

        public void removeListener​(int listenerId)
        Description copied from interface: RTopic
        Removes the listener by id for listening this topic
        Specified by:
        removeListener in interface RTopic<M>
        Parameters:
        listenerId - - listener id