EventHeader
EventHeader is a metadata container that accompanies an event in event-driven systems. It is designed to carry contextual information that describes, routes, and manages the event without including the actual payload. The header enables systems to interpret and process events consistently across components and services.
Typical fields found in an EventHeader include:
- eventId: a unique identifier for the event
- eventType or kind: a descriptor of the event's semantic meaning
- source: the origin or producer of the event
- timestamp: when the event was created
- dataContentType or contentType: the format of the event payload
- specVersion or version: the schema or protocol version
- correlationId: used to correlate related events across systems
- causationId: points to the initiating event in a chain
- traceId: for distributed tracing
- tenantId or userId: context about the actor or tenancy
- priority or retryCount: handling hints for processing
Role and benefits: EventHeaders enable routing, filtering, and auditing; they support idempotency and replay semantics; and
Implementation notes: Headers are typically serialized as a map or record attached to the event, and
Design considerations: maintain consistent naming, define mandatory versus optional fields, manage schema evolution, respect privacy and
See also: CloudEvents, event-driven architecture, message headers, tracing.