Message Producer (kombu.Producer).
Handles serialization (Kombu.Serialization), compression (Kombu.Compression),
automatic exchange/entity declaration (maybe_declare), connection retry (ensure),
and batched Redis publishing (Producer.batch/3).
Summary
Functions
Executes fun within a batched publish session (with producer.batch(max_size=...)).
Resolves and returns the concrete channel for producer.
Declares the producer's default exchange if it has a non-empty name (Producer.declare).
Flushes any messages currently buffered in the active Producer.batch context.
Declares entity unless already declared during this connection session (Producer.maybe_declare).
Creates a new %Kombu.Producer{}.
Serializes and optionally compresses body for publishing (Producer._prepare).
Publishes a message to the broker (Producer.publish).
Releases the producer (Producer.release / Producer.close).
Revives the producer with a new channel or connection after connection loss (Producer.revive).
Returns true if the active transport supports batched publishing (Producer.supports_batch_publish).
Types
Functions
@spec batch(t(), pos_integer() | keyword(), (map() -> result) | (-> result)) :: result when result: var
Executes fun within a batched publish session (with producer.batch(max_size=...)).
Supports nested Producer.batch blocks on the same process. When the outermost
batch block exits normally, any buffered messages are flushed in a single pipeline.
If an exception is raised, buffered messages are discarded.
@spec channel(t()) :: Kombu.Channel.t()
Resolves and returns the concrete channel for producer.
@spec close(t()) :: :ok
@spec declare(t()) :: :ok
Declares the producer's default exchange if it has a non-empty name (Producer.declare).
@spec flush_active_batch!() :: :ok
Flushes any messages currently buffered in the active Producer.batch context.
Declares entity unless already declared during this connection session (Producer.maybe_declare).
@spec new(Kombu.Connection.t() | Kombu.Channel.t() | function() | nil, keyword()) :: t()
Creates a new %Kombu.Producer{}.
Serializes and optionally compresses body for publishing (Producer._prepare).
Returns {prepared_body, content_type, content_encoding, updated_headers}.
Publishes a message to the broker (Producer.publish).
@spec release(t()) :: :ok
Releases the producer (Producer.release / Producer.close).
@spec revive(t(), Kombu.Connection.t() | Kombu.Channel.t() | function()) :: t()
Revives the producer with a new channel or connection after connection loss (Producer.revive).
Returns true if the active transport supports batched publishing (Producer.supports_batch_publish).