Record Class ReliableTopic.TopicMessage<T>

java.lang.Object
java.lang.Record
com.loomcache.server.datastructures.ReliableTopic.TopicMessage<T>
Type Parameters:
T - the payload type
Record Components:
sequence - the monotonic sequence number assigned on publish
timestampMs - the wall-clock time of publish (epoch millis)
payload - the message payload
publisherId - optional identifier of the publisher
Enclosing class:
ReliableTopic<T>

public static record ReliableTopic.TopicMessage<T>(long sequence, long timestampMs, T payload, @Nullable String publisherId) extends Record
A message stored in the ReliableTopic's ringbuffer.
Since:
1.1
  • Constructor Details

    • TopicMessage

      public TopicMessage(long sequence, long timestampMs, T payload, @Nullable String publisherId)
      Creates an instance of a TopicMessage record class.
      Parameters:
      sequence - the value for the sequence record component
      timestampMs - the value for the timestampMs record component
      payload - the value for the payload record component
      publisherId - the value for the publisherId record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • sequence

      public long sequence()
      Returns the value of the sequence record component.
      Returns:
      the value of the sequence record component
    • timestampMs

      public long timestampMs()
      Returns the value of the timestampMs record component.
      Returns:
      the value of the timestampMs record component
    • payload

      public T payload()
      Returns the value of the payload record component.
      Returns:
      the value of the payload record component
    • publisherId

      public @Nullable String publisherId()
      Returns the value of the publisherId record component.
      Returns:
      the value of the publisherId record component