Message for the KubeMQ Queues pattern.
Supports delivery policies (expiration, delay, dead-letter) and server-populated attributes on receive.
Fields
id(String.t() | nil) — Unique message identifier. Auto-generated if nil.channel(String.t()) — Target queue 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 byKubeMQ.Client.tags(%{String.t() => String.t()}) — Key-value tags. Default:%{}.policy(KubeMQ.QueuePolicy.t() | nil) — Delivery policy (expiration, delay, dead-letter).attributes(KubeMQ.QueueAttributes.t() | nil) — Server-populated attributes (present only on received messages).
Usage
msg = KubeMQ.QueueMessage.new(
channel: "orders",
body: payload,
policy: KubeMQ.QueuePolicy.new(delay_seconds: 30)
)
Summary
Functions
Create a new QueueMessage struct from keyword options.
Types
@type t() :: %KubeMQ.QueueMessage{ attributes: KubeMQ.QueueAttributes.t() | nil, body: binary() | nil, channel: String.t(), client_id: String.t() | nil, id: String.t() | nil, metadata: String.t() | nil, policy: KubeMQ.QueuePolicy.t() | nil, tags: %{required(String.t()) => String.t()} }
Functions
Create a new QueueMessage struct from keyword options.
Options
:id— Message ID string (auto-generated if nil):channel— Target queue channel name (required for sending):metadata— Metadata string:body— Message payload (binary):client_id— Client identifier (set automatically byKubeMQ.Client):tags— Key-value tags map (default:%{}):policy—KubeMQ.QueuePolicystruct for delivery policy:attributes—KubeMQ.QueueAttributesstruct (server-populated on receive)
Examples
iex> msg = KubeMQ.QueueMessage.new(channel: "orders", body: "order-data")
iex> msg.channel
"orders"
iex> msg.tags
%{}