Kombu.Queue (Kombu v0.1.0)

Copy Markdown View Source

A Queue declaration (kombu.entity.Queue).

Summary

Functions

Converts the queue into a dictionary representation (as_dict).

Raises Kombu.NotBoundError if neither queue.channel nor channel is bound.

Binds the queue (and its exchange if present) to channel.

Binds the queue to exchange with routing_key (Queue.bind_to).

Returns true if the queue is bound to a channel.

Returns true if declaration of this queue can be cached (not auto_delete and not expiring).

Returns true if the queue should be declared on the broker.

Cancels a consumer by tag (Queue.cancel).

Starts a queue consumer (Queue.consume).

Declares the exchange (if any), declares the queue, and binds the queue. Returns {:ok, queue_name} or queue_name matching kombu.entity.Queue.declare.

Deletes the queue (Queue.delete).

Compares two %Kombu.Queue{} structs for value equality (ignoring channel binding).

Constructs a %Kombu.Queue{} from a dictionary (Queue.from_dict).

Polls the server for a single message in the queue (Queue.get).

Binds the queue (and its exchange) to channel if not already bound.

Creates a new %Kombu.Queue{}. Supports

Purges all ready messages from the queue (Queue.purge).

Creates the queue binding(s) on the broker (Queue.queue_bind).

Declares the queue on the broker (Queue.queue_declare). Returns the queue name.

Revives the queue with a new channel (Queue.revive).

Builds RabbitMQ-compatible queue arguments (x-expires, x-message-ttl, x-max-length, x-max-length-bytes, x-max-priority) merged with arguments.

Unbinds the queue from its configured exchange (Queue.unbind).

Unbinds the queue from exchange (Queue.unbind_from).

Types

t()

@type t() :: %Kombu.Queue{
  alias: String.t() | nil,
  auto_delete: boolean(),
  binding_arguments: map() | nil,
  bindings: [Kombu.Binding.t()],
  channel: Kombu.Channel.t() | nil,
  consumer_arguments: map() | nil,
  durable: boolean(),
  exchange: Kombu.Exchange.t() | nil,
  exclusive: boolean(),
  expires: number() | nil,
  max_length: integer() | nil,
  max_length_bytes: integer() | nil,
  max_priority: integer() | nil,
  message_ttl: number() | nil,
  name: String.t(),
  no_ack: boolean(),
  no_declare: boolean(),
  on_declared:
    (String.t(), non_neg_integer(), non_neg_integer() -> any()) | nil,
  queue_arguments: map() | nil,
  routing_key: String.t()
}

Functions

as_dict(queue, opts \\ [])

@spec as_dict(t(), keyword()) :: map()

Converts the queue into a dictionary representation (as_dict).

assert_bound!(queue, channel \\ nil)

@spec assert_bound!(t(), Kombu.Channel.t() | nil) :: Kombu.Channel.t()

Raises Kombu.NotBoundError if neither queue.channel nor channel is bound.

bind(queue, channel)

@spec bind(t(), Kombu.Channel.t() | nil) :: t()

Binds the queue (and its exchange if present) to channel.

bind_to(queue, exchange \\ "", opts \\ [])

@spec bind_to(t(), Kombu.Exchange.t() | String.t() | nil, keyword()) :: term()

Binds the queue to exchange with routing_key (Queue.bind_to).

bound?(queue)

@spec bound?(t()) :: boolean()

Returns true if the queue is bound to a channel.

can_cache_declaration?(queue)

@spec can_cache_declaration?(t()) :: boolean()

Returns true if declaration of this queue can be cached (not auto_delete and not expiring).

can_declare?(queue)

@spec can_declare?(t()) :: boolean()

Returns true if the queue should be declared on the broker.

cancel(queue, consumer_tag, opts \\ [])

@spec cancel(t(), String.t(), keyword()) :: term()

Cancels a consumer by tag (Queue.cancel).

consume(queue, consumer_tag \\ "", callback \\ nil, opts \\ [])

@spec consume(t(), String.t() | keyword(), function() | nil | keyword(), keyword()) ::
  term()

Starts a queue consumer (Queue.consume).

declare(queue, opts \\ [])

@spec declare(t(), keyword()) :: String.t()

Declares the exchange (if any), declares the queue, and binds the queue. Returns {:ok, queue_name} or queue_name matching kombu.entity.Queue.declare.

delete(queue, opts \\ [])

@spec delete(t(), keyword()) :: term()

Deletes the queue (Queue.delete).

equal?(a, b)

@spec equal?(t(), term()) :: boolean()

Compares two %Kombu.Queue{} structs for value equality (ignoring channel binding).

from_dict(queue_name, options)

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

Constructs a %Kombu.Queue{} from a dictionary (Queue.from_dict).

get(queue, opts \\ [])

@spec get(t(), keyword()) :: Kombu.Message.t() | nil

Polls the server for a single message in the queue (Queue.get).

maybe_bind(queue, channel)

@spec maybe_bind(t(), Kombu.Channel.t() | nil) :: t()

Binds the queue (and its exchange) to channel if not already bound.

new(name \\ "", exchange_or_opts \\ [])

Creates a new %Kombu.Queue{}. Supports:

  • Queue.new(name, opts)
  • Queue.new(name, exchange, opts)
  • Queue.new(name, exchange, routing_key, opts)

new(name, exchange, opts)

new(name, exchange, routing_key, opts)

purge(queue, opts \\ [])

@spec purge(t(), keyword()) :: non_neg_integer()

Purges all ready messages from the queue (Queue.purge).

queue_bind(queue, opts \\ [])

@spec queue_bind(t(), keyword()) :: term()

Creates the queue binding(s) on the broker (Queue.queue_bind).

queue_declare(queue, opts \\ [])

@spec queue_declare(t(), keyword()) :: String.t()

Declares the queue on the broker (Queue.queue_declare). Returns the queue name.

revive(queue, channel)

@spec revive(t(), term()) :: t()

Revives the queue with a new channel (Queue.revive).

to_rabbitmq_queue_arguments(arguments \\ nil, opts \\ [])

@spec to_rabbitmq_queue_arguments(map() | nil, keyword()) :: map() | nil

Builds RabbitMQ-compatible queue arguments (x-expires, x-message-ttl, x-max-length, x-max-length-bytes, x-max-priority) merged with arguments.

unbind(queue, opts \\ [])

@spec unbind(t(), keyword()) :: term()

Unbinds the queue from its configured exchange (Queue.unbind).

unbind_from(queue, exchange \\ "", opts \\ [])

@spec unbind_from(t(), Kombu.Exchange.t() | String.t() | nil, keyword()) :: term()

Unbinds the queue from exchange (Queue.unbind_from).