Record Class MessageHistoryService.StoredMessage

java.lang.Object
java.lang.Record
dev.agenor.tools.history.MessageHistoryService.StoredMessage
Enclosing class:
MessageHistoryService

public static record MessageHistoryService.StoredMessage(String id, String topic, String senderId, String receiverId, String correlationId, Object payload, Map<String,String> headers, Instant timestamp, Instant storedAt) extends Record
Stored message wrapper with additional metadata.
  • Constructor Details

    • StoredMessage

      public StoredMessage(String id, String topic, String senderId, String receiverId, String correlationId, Object payload, Map<String,String> headers, Instant timestamp, Instant storedAt)
      Creates an instance of a StoredMessage record class.
      Parameters:
      id - the value for the id record component
      topic - the value for the topic record component
      senderId - the value for the senderId record component
      receiverId - the value for the receiverId record component
      correlationId - the value for the correlationId record component
      payload - the value for the payload record component
      headers - the value for the headers record component
      timestamp - the value for the timestamp record component
      storedAt - the value for the storedAt record component
  • Method Details

    • from

      public static MessageHistoryService.StoredMessage from(Message message)
      Creates a StoredMessage from a Message.
    • toMap

      public Map<String,Object> toMap()
      Converts to a Map for JSON serialization.
    • 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 Objects::equals(Object,Object).
      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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • topic

      public String topic()
      Returns the value of the topic record component.
      Returns:
      the value of the topic record component
    • senderId

      public String senderId()
      Returns the value of the senderId record component.
      Returns:
      the value of the senderId record component
    • receiverId

      public String receiverId()
      Returns the value of the receiverId record component.
      Returns:
      the value of the receiverId record component
    • correlationId

      public String correlationId()
      Returns the value of the correlationId record component.
      Returns:
      the value of the correlationId record component
    • payload

      public Object payload()
      Returns the value of the payload record component.
      Returns:
      the value of the payload record component
    • headers

      public Map<String,String> headers()
      Returns the value of the headers record component.
      Returns:
      the value of the headers record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • storedAt

      public Instant storedAt()
      Returns the value of the storedAt record component.
      Returns:
      the value of the storedAt record component