Kombu.Transport.Redis.PublishBatch (Kombu v0.1.0)

Copy Markdown View Source

Batched Redis publisher (kombu.transport.redis.PublishBatch).

Coalesces routing lookups (SMEMBERS _kombu.binding.<exchange>) and pipelines all LPUSH, PUBLISH, and PEXPIRE commands in a single round-trip.

Summary

Functions

Discards all pending messages in the batch.

Enqueues a prepared message map with exchange and routing_key into the batch.

Flushes all queued messages using channel_state (a %Kombu.Transport.Redis.Channel{} struct). Returns {:ok, new_batch}.

Returns the count of queued messages in the batch.

Types

entry()

@type entry() :: {map(), String.t(), String.t()}

t()

@type t() :: %Kombu.Transport.Redis.PublishBatch{entries: [entry()]}

Functions

discard(batch)

@spec discard(t()) :: t()

Discards all pending messages in the batch.

enqueue(batch, message, exchange, routing_key, opts \\ [])

@spec enqueue(t(), map(), String.t() | nil, String.t() | nil, keyword()) :: t()

Enqueues a prepared message map with exchange and routing_key into the batch.

flush(batch, channel_state)

@spec flush(t(), struct()) :: {:ok, t()}

Flushes all queued messages using channel_state (a %Kombu.Transport.Redis.Channel{} struct). Returns {:ok, new_batch}.

new(opts \\ [])

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

size(publish_batch)

@spec size(t()) :: non_neg_integer()

Returns the count of queued messages in the batch.