public interface

Topic

com.atlassian.bitbucket.topic.Topic<T extends java.io.Serializable>

Summary

Public Methods
@Nonnull TopicSettings<T> getSettings()
void publish(T message)
Publishes a message to all (both local and on other cluster nodes) listeners of the topic.
@Nonnull String subscribe(TopicListener<T> listener)
Subscribes the provided listener to the topic.
boolean unsubscribe(String subscriptionId)
Unsubscribes a listener.

Public Methods

@Nonnull public TopicSettings<T> getSettings ()

Returns
  • the topic configuration

public void publish (T message)

Publishes a message to all (both local and on other cluster nodes) listeners of the topic.

Parameters
message the message

@Nonnull public String subscribe (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

public boolean unsubscribe (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