Interface Topic<T extends Serializable>


public interface Topic<T extends Serializable>
Since:
5.3
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    publish(T message)
    Publishes a message to all (both local and on other cluster nodes) listeners of the topic.
    Subscribes the provided listener to the topic.
    boolean
    unsubscribe(String subscriptionId)
    Unsubscribes a listener.
  • Method Details

    • getSettings

      @Nonnull TopicSettings<T> getSettings()
      Returns:
      the topic configuration
    • publish

      void publish(@Nonnull T message)
      Publishes a message to all (both local and on other cluster nodes) listeners of the topic.
      Parameters:
      message - the message
    • subscribe

      @Nonnull String subscribe(@Nonnull TopicListener<T> listener)
      Subscribes the provided listener to the topic. The listener will receive callbacks for every message published to the topic after the listener was subscribed.
      Parameters:
      listener - the listener that should receive callbacks when a message is published to the topic
      Returns:
      the subscription ID, used to unsubscribe.
    • unsubscribe

      boolean unsubscribe(@Nonnull String subscriptionId)
      Unsubscribes a listener. The listener will receive no more messages from the topic.
      Parameters:
      subscriptionId - the subscription ID that was returned by subscribe(TopicListener)
      Returns:
      true if the listener was successfully unsubscribed, otherwise false