Simple API for persistent queues.
Wraps a Kombu.Consumer and Kombu.Producer to offer a familiar queue-like
interface with put, get, get_nowait, qsize, clear, and close.
Summary
Functions
Purges all messages from the queue.
Closes the simple queue, cancelling consumers and stopping state agent.
Returns true if the queue has no messages.
Retrieves a message from the queue.
Non-blocking retrieval of a message from the queue (Queue.get).
Raises Kombu.Empty if no message is available.
Creates a new SimpleQueue.
Publishes a message to the queue.
Returns the current number of messages in the queue.
Types
@type t() :: %Kombu.Simple.SimpleQueue{ channel: term(), consumer: Kombu.Consumer.t(), no_ack: boolean(), producer: Kombu.Producer.t(), queue: Kombu.Queue.t(), state_pid: pid() }
Functions
@spec clear(t()) :: non_neg_integer()
Purges all messages from the queue.
@spec close(t()) :: :ok
Closes the simple queue, cancelling consumers and stopping state agent.
Returns true if the queue has no messages.
@spec get(t(), keyword()) :: Kombu.Message.t()
Retrieves a message from the queue.
If block: false, returns immediately or raises Kombu.Empty.
If block: true, waits up to timeout seconds for a message.
@spec get_nowait(t()) :: Kombu.Message.t()
Non-blocking retrieval of a message from the queue (Queue.get).
Raises Kombu.Empty if no message is available.
@spec new(term(), String.t() | Kombu.Queue.t(), keyword()) :: t()
Creates a new SimpleQueue.
channel can be a %Kombu.Connection{} or channel.
name_or_queue can be a binary queue name or a %Kombu.Queue{} struct.
Options:
:no_ack- whether received messages are automatically acknowledged (defaultfalse):queue_opts- keyword options for creating the queue:queue_args- queue arguments map:exchange_opts- exchange options (defaults to[type: "direct"]):serializer- default serialization format:compression- default compression format:accept- accepted content types list
Publishes a message to the queue.
@spec qsize(t()) :: non_neg_integer()
Returns the current number of messages in the queue.