KubeMQ.Command (kubemq v1.0.1)

Copy Markdown View Source

Command message for the KubeMQ RPC pattern.

Commands are fire-and-wait messages: the sender blocks until the receiver executes and responds, or the timeout expires.

Fields

  • id (String.t() | nil) — Unique command identifier. Auto-generated if nil.

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

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

  • timeout (pos_integer()) — Timeout in milliseconds. Default: 10_000.
  • client_id (String.t() | nil) — Sender identifier. Set automatically by KubeMQ.Client.

  • tags (%{String.t() => String.t()}) — Key-value tags. Default: %{}.
  • span (binary() | nil) — Tracing span context (internal).

Usage

cmd = KubeMQ.Command.new(channel: "orders.process", body: payload, timeout: 10_000)
{:ok, response} = KubeMQ.Client.send_command(client, cmd)

Summary

Functions

Create a new Command struct from keyword options.

Types

t()

@type t() :: %KubeMQ.Command{
  body: binary() | nil,
  channel: String.t(),
  client_id: String.t() | nil,
  id: String.t() | nil,
  metadata: String.t() | nil,
  span: binary() | nil,
  tags: %{required(String.t()) => String.t()},
  timeout: pos_integer()
}

Functions

new(opts \\ [])

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

Create a new Command struct from keyword options.

Options

  • :id — Command ID string (auto-generated if nil)
  • :channel — Target channel name (required for sending)
  • :metadata — Metadata string
  • :body — Command payload (binary)
  • :timeout — Timeout in milliseconds (default: 10_000)
  • :client_id — Client identifier (set automatically by KubeMQ.Client)
  • :tags — Key-value tags map (default: %{})

Examples

iex> cmd = KubeMQ.Command.new(channel: "orders.process", body: "data")
iex> cmd.channel
"orders.process"
iex> cmd.timeout
10000