Record Class TopicConfig
java.lang.Object
java.lang.Record
com.loomcache.server.topic.TopicConfig
public record TopicConfig(int maxBufferSize, boolean reliableDelivery, boolean ordered)
extends Record
Configuration for a distributed topic.
Records the following settings:
- maxBufferSize: Maximum number of messages to retain for replay (default: 10000)
- reliableDelivery: Whether to enable reliable message delivery with storage (default: true)
- ordered: Whether to enforce FIFO message ordering per publisher (default: true)
Thread-safe: This record is immutable and inherently thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final booleanstatic final boolean -
Constructor Summary
ConstructorsConstructorDescriptionTopicConfig(int maxBufferSize, boolean reliableDelivery, boolean ordered) Validate configuration values. -
Method Summary
Modifier and TypeMethodDescriptionstatic TopicConfigdefaults()Create a topic configuration with default values.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxBufferSizerecord component.booleanordered()Returns the value of theorderedrecord component.booleanReturns the value of thereliableDeliveryrecord component.final StringtoString()Returns a string representation of this record class.static TopicConfigwithBufferSize(int maxBufferSize) Create a topic configuration with custom buffer size.
-
Field Details
-
DEFAULT_MAX_BUFFER_SIZE
public static final int DEFAULT_MAX_BUFFER_SIZE- See Also:
-
DEFAULT_RELIABLE_DELIVERY
public static final boolean DEFAULT_RELIABLE_DELIVERY- See Also:
-
DEFAULT_ORDERED
public static final boolean DEFAULT_ORDERED- See Also:
-
-
Constructor Details
-
TopicConfig
public TopicConfig(int maxBufferSize, boolean reliableDelivery, boolean ordered) Validate configuration values.- Throws:
IllegalArgumentException- if maxBufferSize is not positive
-
-
Method Details
-
defaults
Create a topic configuration with default values.- Returns:
- TopicConfig with defaults
-
withBufferSize
Create a topic configuration with custom buffer size.- Parameters:
maxBufferSize- Maximum buffer size (must be positive)- Returns:
- TopicConfig with specified buffer size and default other values
- Throws:
IllegalArgumentException- if maxBufferSize is not positive
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
maxBufferSize
public int maxBufferSize()Returns the value of themaxBufferSizerecord component.- Returns:
- the value of the
maxBufferSizerecord component
-
reliableDelivery
public boolean reliableDelivery()Returns the value of thereliableDeliveryrecord component.- Returns:
- the value of the
reliableDeliveryrecord component
-
ordered
public boolean ordered()Returns the value of theorderedrecord component.- Returns:
- the value of the
orderedrecord component
-