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

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final boolean
     
    static final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TopicConfig(int maxBufferSize, boolean reliableDelivery, boolean ordered)
    Validate configuration values.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a topic configuration with default values.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxBufferSize record component.
    boolean
    Returns the value of the ordered record component.
    boolean
    Returns the value of the reliableDelivery record component.
    final String
    Returns a string representation of this record class.
    withBufferSize(int maxBufferSize)
    Create a topic configuration with custom buffer size.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      public static TopicConfig defaults()
      Create a topic configuration with default values.
      Returns:
      TopicConfig with defaults
    • withBufferSize

      public static TopicConfig withBufferSize(int maxBufferSize)
      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

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxBufferSize

      public int maxBufferSize()
      Returns the value of the maxBufferSize record component.
      Returns:
      the value of the maxBufferSize record component
    • reliableDelivery

      public boolean reliableDelivery()
      Returns the value of the reliableDelivery record component.
      Returns:
      the value of the reliableDelivery record component
    • ordered

      public boolean ordered()
      Returns the value of the ordered record component.
      Returns:
      the value of the ordered record component