Record Class WireEnvelope
java.lang.Object
java.lang.Record
com.iantapply.relay.core.WireEnvelope
- Record Components:
schema- wire schema versionid- unique message identifiertopic- topic nameorigin- publishing node identifierdestination- intended recipientscreatedAt- publishing timestampcontentType- codec representation identifiercorrelationId- related message identifier, ornullheaders- immutable application metadatapayload- 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
FieldsModifier and TypeFieldDescriptionstatic final intCurrent Relay envelope schema version. -
Constructor Summary
ConstructorsConstructorDescriptionWireEnvelope(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 TypeMethodDescriptionReturns the value of thecontentTyperecord component.com.iantapply.relay.api.MessageIdReturns the value of thecorrelationIdrecord component.Returns the value of thecreatedAtrecord component.com.iantapply.relay.api.DestinationReturns the value of thedestinationrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.com.iantapply.relay.api.MessageIdid()Returns the value of theidrecord component.origin()Returns the value of theoriginrecord component.byte[]payload()Returns a defensive copy of the encoded application payload.intschema()Returns the value of theschemarecord component.topic()Returns the value of thetopicrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CURRENT_SCHEMA
public static final int CURRENT_SCHEMACurrent 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 versionid- unique message identifiertopic- topic nameorigin- publishing node identifierdestination- intended recipientscreatedAt- publishing timestampcontentType- codec representation identifiercorrelationId- related message identifier, ornullheaders- application metadatapayload- encoded application payload
-
-
Method Details
-
payload
public byte[] payload()Returns a defensive copy of the encoded application payload.- Returns:
- copied payload bytes
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
schema
-
id
-
topic
-
origin
-
destination
public com.iantapply.relay.api.Destination destination()Returns the value of thedestinationrecord component.- Returns:
- the value of the
destinationrecord component
-
createdAt
-
contentType
Returns the value of thecontentTyperecord component.- Returns:
- the value of the
contentTyperecord component
-
correlationId
public com.iantapply.relay.api.MessageId correlationId()Returns the value of thecorrelationIdrecord component.- Returns:
- the value of the
correlationIdrecord component
-
headers
-