Orkestra.Metadata (orkestra v0.2.0)

Copy Markdown View Source

Metadata carried by every command and event envelope.

Contains correlation, causation, identity, and timing information that flows through the entire command/event pipeline.

Summary

Functions

Derives child metadata from a parent, preserving correlation and setting causation.

Creates new metadata with a fresh correlation_id.

Types

t()

@type t() :: %Orkestra.Metadata{
  actor_id: String.t() | nil,
  actor_type: atom(),
  causation_id: String.t() | nil,
  correlation_id: String.t(),
  issued_at: DateTime.t(),
  source: String.t() | nil
}

Functions

derive(parent, causation_id)

@spec derive(t(), String.t()) :: t()

Derives child metadata from a parent, preserving correlation and setting causation.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates new metadata with a fresh correlation_id.

Options

  • :actor_id — who is issuing this (user id, system name, etc.)
  • :actor_type:user, :system, :expert, :scheduler
  • :source — where this originated (e.g. "web", "api", "cli", "rabbitmq")
  • :causation_id — id of the command/event that caused this one