KubeMQ.Event (kubemq v1.0.1)

Copy Markdown View Source

Event message for the KubeMQ Pub/Sub pattern.

Events are fire-and-forget messages delivered to all active subscribers on a channel. The store field must remain false for non-persistent events (use KubeMQ.EventStore for persistent events).

Fields

  • id (String.t() | nil) — Unique event identifier. Auto-generated by the server if nil.

  • channel (String.t()) — Target channel name. Required for sending.
  • metadata (String.t() | nil) — Optional metadata string.

  • body (binary() | nil) — Message payload.

  • client_id (String.t() | nil) — Sender identifier. Set automatically by KubeMQ.Client.

  • tags (%{String.t() => String.t()}) — Key-value tags for filtering. Default: %{}.
  • store (boolean()) — Always false. Use KubeMQ.EventStore for persistent events.

Usage

event = KubeMQ.Event.new(channel: "notifications", body: "hello")
:ok = KubeMQ.Client.send_event(client, event)

Summary

Functions

Create a new Event struct from keyword options.

Types

t()

@type t() :: %KubeMQ.Event{
  body: binary() | nil,
  channel: String.t(),
  client_id: String.t() | nil,
  id: String.t() | nil,
  metadata: String.t() | nil,
  store: boolean(),
  tags: %{required(String.t()) => String.t()}
}

Functions

new(opts \\ [])

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

Create a new Event struct from keyword options.

Options

  • :id — Event ID string (auto-generated if nil)
  • :channel — Target channel name (required for sending)
  • :metadata — Metadata string
  • :body — Message body (binary)
  • :client_id — Client identifier (set automatically by KubeMQ.Client)
  • :tags — Key-value tags map (default: %{})

Examples

iex> event = KubeMQ.Event.new(channel: "notifications", body: "hello")
iex> event.channel
"notifications"
iex> event.body
"hello"
iex> event.store
false