Envelope
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.