public class

TopicSettings

extends Object
java.lang.Object
   ↳ com.atlassian.bitbucket.topic.TopicSettings<T extends java.io.Serializable>

Class Overview

Settings for creating a Topic. Allows the topic creator to control the message queue size and the message deduplication policy.

Summary

Nested Classes
class TopicSettings.Builder<T extends Serializable>  
Constants
int QUEUE_SIZE_DEFAULT
Public Methods
@Nonnull static <T extends Serializable> Builder<T> builder(Class<T> messageType)
@Nonnull Optional<Class<T>> getMessageType()
int getQueueSize()
If the rate at which messages are published on the topic (temporarily) exceeds the rate at which the messages are consumed, pending messages will be stored on the topic's message queue.
boolean isDedupePendingMessages()
Whether identical messages that haven't been dispatched yet should be deduplicated.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int QUEUE_SIZE_DEFAULT

Constant Value: -1 (0xffffffff)

Public Methods

@Nonnull public static Builder<T> builder (Class<T> messageType)

@Nonnull public Optional<Class<T>> getMessageType ()

Returns
  • the type of message that will be sent to the topic, or empty() if none has been provided

public int getQueueSize ()

If the rate at which messages are published on the topic (temporarily) exceeds the rate at which the messages are consumed, pending messages will be stored on the topic's message queue. This setting controls how many messages can be stored on the queue. When the queue is full, messages will be dropped (and errors logged).

Returns
  • the maximum number of messages that can be queued for the topic. A value of QUEUE_SIZE_DEFAULT indicates that the default queue size will be used.

public boolean isDedupePendingMessages ()

Whether identical messages that haven't been dispatched yet should be deduplicated. Enabling this prevents the message queue from filling up with identical messages. The deduplication only applies to pending messages and does not take into account any messages that have been dispatched to the TopicListener in the past. Enabling this option is not appropriate for listeners that care about timestamp on the message, since deduplication only retains the oldest (identical) message in the queue. Deduplication is performed by using the equals method on the message.

Returns
  • whether messages should deduplicated in the message queue