Record Class Envelope

java.lang.Object
java.lang.Record
com.babelqueue.Envelope
Record Components:
job - the message URN (never a class name)
traceId - correlation id, preserved across every hop
data - the pure-JSON payload
meta - the immutable metadata block
attempts - the top-level transport retry counter
deadLetter - the dead-letter block, or null until dead-lettered

public record Envelope(String job, String traceId, Map<String,Object> data, Meta meta, int attempts, DeadLetter deadLetter) extends Record
The canonical BabelQueue wire message: a strict, language-neutral JSON shape ({job, trace_id, data, meta, attempts}) that every SDK produces and consumes identically — no language-specific serialization on the wire.

Build one with EnvelopeCodec.make(java.lang.String, java.util.Map<java.lang.String, java.lang.Object>), render it with EnvelopeCodec.encode(com.babelqueue.Envelope), and parse inbound bytes with EnvelopeCodec.decode(java.lang.String). The record is immutable; DeadLetters returns a copy with a DeadLetter attached.

  • Constructor Details

    • Envelope

      public Envelope(String job, String traceId, Map<String,Object> data, Meta meta, int attempts, DeadLetter deadLetter)
      Creates an instance of a Envelope record class.
      Parameters:
      job - the value for the job record component
      traceId - the value for the traceId record component
      data - the value for the data record component
      meta - the value for the meta record component
      attempts - the value for the attempts record component
      deadLetter - the value for the deadLetter 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 '=='.
      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.
    • job

      public String job()
      Returns the value of the job record component.
      Returns:
      the value of the job record component
    • traceId

      public String traceId()
      Returns the value of the traceId record component.
      Returns:
      the value of the traceId record component
    • data

      public Map<String,Object> data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • meta

      public Meta meta()
      Returns the value of the meta record component.
      Returns:
      the value of the meta record component
    • attempts

      public int attempts()
      Returns the value of the attempts record component.
      Returns:
      the value of the attempts record component
    • deadLetter

      public DeadLetter deadLetter()
      Returns the value of the deadLetter record component.
      Returns:
      the value of the deadLetter record component