Interface TopicService


public interface TopicService
Provides a mechanism for publishing messages to multiple subscribers, both local and cluster-wide. When a listener subscribes to a topic, it receives all messages published to that topic from any node until the listener unsubscribes.

Messages are delivered in the order they were published on the node they were published on. If node N publishes messages m1, m2..mn, all listeners receive messages m1, m2..mn in order.

Messages are not durable and message delivery is guaranteed only to the listeners that were reachable at the time a message is published. In the case of network partitions, listeners may miss messages. Plugins that rely on TopicService to handle cluster coherency are encouraged to also listen for the various cluster node events to handle nodes joining, rejoining and leaving the cluster.

  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends Serializable>
    Topic<T>
    getTopic(String topic, TopicSettings<T> settings)
    Returns the existing topic, or creates new topic with the provided settings if it does not yet exist.
  • Method Details

    • getTopic

      @Nonnull <T extends Serializable> Topic<T> getTopic(@Nonnull String topic, @Nonnull TopicSettings<T> settings)
      Returns the existing topic, or creates new topic with the provided settings if it does not yet exist.
      Type Parameters:
      T - the message type of the topic
      Parameters:
      topic - the topic name
      settings - the topic configuration
      Returns:
      the topic
      Since:
      5.3