Package com.atlassian.bitbucket.topic
Class TopicSettings<T extends Serializable>
java.lang.Object
com.atlassian.bitbucket.topic.TopicSettings<T>
Settings for
creating a Topic. Allows the topic creator to
control the message queue size and the message deduplication policy.- Since:
- 5.3
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Serializable>
TopicSettings.Builder<T>intIf 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.booleanWhether identicalmessagesthat haven't been dispatched yet should be deduplicated.
-
Field Details
-
QUEUE_SIZE_DEFAULT
public static final int QUEUE_SIZE_DEFAULT- See Also:
-
-
Method Details
-
builder
@Nonnull public static <T extends Serializable> TopicSettings.Builder<T> builder(@Nullable Class<T> messageType) -
getMessageType
- Returns:
- the type of
messagethat will be sent to the topic, orOptional.empty()if none has been provided
-
getQueueSize
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_DEFAULTindicates that the default queue size will be used.
-
isDedupePendingMessages
public boolean isDedupePendingMessages()Whether identicalmessagesthat 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 theTopicListenerin the past. Enabling this option is not appropriate forlistenersthat care abouttimestampon the message, since deduplication only retains the oldest (identical) message in the queue. Deduplication is performed by using theequalsmethod on themessage.- Returns:
- whether messages should deduplicated in the message queue
-