Kombu.Common (Kombu v0.1.0)

Copy Markdown View Source

Common Kombu utilities (kombu.common), including maybe_declare/3, send_reply/5, collect_replies/4, drain_consumer/2, itermessages/4, eventloop/2, and Kombu.Common.QoS.

Summary

Functions

Collects decoded reply bodies from queue (kombu.common.collect_replies).

Drains up to limit messages from consumer, returning a list of {body, message} tuples (kombu.common.drain_consumer).

Drains events from conn (kombu.common.eventloop), returning a lazy Stream.

Generates a deterministic OID string (kombu.common.generate_oid).

Executes fun.() while ignoring connection and channel errors (kombu.common.ignore_errors).

Consumes up to limit messages from queue on conn/channel (kombu.common.itermessages).

Declares entity on channel_or_conn unless its declaration is already cached (kombu.common.maybe_declare).

Generates an OID for instance.

Publishes a reply message for request req (kombu.common.send_reply).

Generates a UUIDv4 string (kombu.common.uuid).

Functions

collect_replies(conn, channel \\ nil, queue, opts \\ [])

@spec collect_replies(
  Kombu.Connection.t(),
  Kombu.Channel.t() | nil,
  Kombu.Queue.t(),
  keyword()
) :: [
  term()
]

Collects decoded reply bodies from queue (kombu.common.collect_replies).

drain_consumer(consumer, opts \\ [])

@spec drain_consumer(Kombu.Consumer.t(), keyword()) :: [{term(), Kombu.Message.t()}]

Drains up to limit messages from consumer, returning a list of {body, message} tuples (kombu.common.drain_consumer).

eventloop(conn_or_channel, opts \\ [])

@spec eventloop(Kombu.Connection.t() | Kombu.Channel.t(), keyword()) :: Enumerable.t()

Drains events from conn (kombu.common.eventloop), returning a lazy Stream.

generate_oid(node_id, process_id, thread_id, instance_id)

Generates a deterministic OID string (kombu.common.generate_oid).

ignore_errors(conn, fun)

@spec ignore_errors(Kombu.Connection.t() | term(), (-> term())) :: term() | nil

Executes fun.() while ignoring connection and channel errors (kombu.common.ignore_errors).

itermessages(conn, channel \\ nil, queue, opts \\ [])

@spec itermessages(
  Kombu.Connection.t(),
  Kombu.Channel.t() | nil,
  Kombu.Queue.t(),
  keyword()
) :: [
  {term(), Kombu.Message.t()}
]

Consumes up to limit messages from queue on conn/channel (kombu.common.itermessages).

maybe_declare(entity, channel_or_conn \\ nil, opts \\ [])

@spec maybe_declare(
  Kombu.Exchange.t() | Kombu.Queue.t() | Kombu.Binding.t() | nil,
  term(),
  keyword()
) ::
  boolean()

Declares entity on channel_or_conn unless its declaration is already cached (kombu.common.maybe_declare).

Returns true if declared, false if skipped because cached.

oid_from(instance, threads \\ true)

Generates an OID for instance.

prefetch_count_max()

send_reply(exchange, req, msg, producer, opts \\ [])

@spec send_reply(
  Kombu.Exchange.t() | String.t(),
  Kombu.Message.t(),
  term(),
  Kombu.Producer.t(),
  keyword()
) :: :ok

Publishes a reply message for request req (kombu.common.send_reply).

uuid()

Generates a UUIDv4 string (kombu.common.uuid).