Record Class WireEnvelope

java.lang.Object
java.lang.Record
com.iantapply.relay.core.WireEnvelope
Record Components:
schema - wire schema version
id - unique message identifier
topic - topic name
origin - publishing node identifier
destination - intended recipients
createdAt - publishing timestamp
contentType - codec representation identifier
correlationId - related message identifier, or null
headers - immutable application metadata
payload - encoded application payload

public record WireEnvelope(int schema, com.iantapply.relay.api.MessageId id, String topic, String origin, com.iantapply.relay.api.Destination destination, Instant createdAt, String contentType, com.iantapply.relay.api.MessageId correlationId, Map<String,String> headers, byte[] payload) extends Record
Transport-neutral representation of one encoded Relay message.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Current Relay envelope schema version.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WireEnvelope(int schema, com.iantapply.relay.api.MessageId id, String topic, String origin, com.iantapply.relay.api.Destination destination, Instant createdAt, String contentType, com.iantapply.relay.api.MessageId correlationId, Map<String,String> headers, byte[] payload)
    Creates an envelope and defensively copies mutable data.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the contentType record component.
    com.iantapply.relay.api.MessageId
    Returns the value of the correlationId record component.
    Returns the value of the createdAt record component.
    com.iantapply.relay.api.Destination
    Returns the value of the destination record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the headers record component.
    com.iantapply.relay.api.MessageId
    id()
    Returns the value of the id record component.
    Returns the value of the origin record component.
    byte[]
    Returns a defensive copy of the encoded application payload.
    int
    Returns the value of the schema record component.
    Returns the value of the topic record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CURRENT_SCHEMA

      public static final int CURRENT_SCHEMA
      Current Relay envelope schema version.
      See Also:
  • Constructor Details

    • WireEnvelope

      public WireEnvelope(int schema, com.iantapply.relay.api.MessageId id, String topic, String origin, com.iantapply.relay.api.Destination destination, Instant createdAt, String contentType, com.iantapply.relay.api.MessageId correlationId, Map<String,String> headers, byte[] payload)
      Creates an envelope and defensively copies mutable data.
      Parameters:
      schema - wire schema version
      id - unique message identifier
      topic - topic name
      origin - publishing node identifier
      destination - intended recipients
      createdAt - publishing timestamp
      contentType - codec representation identifier
      correlationId - related message identifier, or null
      headers - application metadata
      payload - encoded application payload
  • Method Details

    • payload

      public byte[] payload()
      Returns a defensive copy of the encoded application payload.
      Returns:
      copied payload bytes
    • 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.
    • schema

      public int schema()
      Returns the value of the schema record component.
      Returns:
      the value of the schema record component
    • id

      public com.iantapply.relay.api.MessageId 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
    • origin

      public String origin()
      Returns the value of the origin record component.
      Returns:
      the value of the origin record component
    • destination

      public com.iantapply.relay.api.Destination destination()
      Returns the value of the destination record component.
      Returns:
      the value of the destination record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component
    • contentType

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

      public com.iantapply.relay.api.MessageId correlationId()
      Returns the value of the correlationId record component.
      Returns:
      the value of the correlationId record component
    • headers

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