Envelope

class Envelope @InternalWowApi constructor(val kind: EnvelopeKind, val id: String, val type: String, val payload: JsonNode, val transport: Transport? = null, val format: Int = FORMAT)

A message of a Kafka topic: {format, kind, id, type, payload, transport}.

  • format is the envelope's format version. A field added with a default does not change it; a reader refuses a format it does not know, which only a major version brings.

  • id is what a reader deduplicates by: delivery is at least once.

  • type names what payload is: the aggregate type of a state event (context.aggregate), the command type of a command (context.aggregate.Command).

  • payload is an embedded JSON object, never a string holding one, so a reader takes values by path and a person reads it as it is.

  • transport is the delivery metadata: the wait context and the trace, never a fact.

The Kafka key is not in the envelope: it is the aggregate ref (context.aggregate/tenant/id), so the messages of an aggregate keep their order in one partition. The headers repeat format, kind and type (EnvelopeHeaders), so a reader filters without parsing the value.

Fields may be added: construct one with of; the constructor is internal to Wow.

Constructors

Link copied to clipboard
constructor(kind: EnvelopeKind, id: String, type: String, payload: JsonNode, transport: Transport? = null, format: Int = FORMAT)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val format: Int
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
val payload: JsonNode
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String