Message Consumer (kombu.Consumer).
Manages queue declarations, QoS prefetch settings, consumer tags, content-type
acceptance checks (DisallowedSerializerError), automatic message decoding,
on_decode_error handling, and callback dispatch.
Summary
Functions
Returns the accepted content types for this consumer.
Returns the active consumer tags map.
Adds a queue to the consumer without starting consumption (Consumer.add_queue).
Call consume/2 afterwards to begin consuming from the added queue.
Cancels all active queue consumers (Consumer.cancel / Consumer.close).
Cancels consumption from a single queue and removes it from the consumer (Consumer.cancel_by_queue).
Returns the channel or channel promise for this consumer.
Starts consuming messages from all registered queues (Consumer.consume).
Returns true if consumer is currently consuming from queue_or_name (Consumer.consuming_from).
Declares all registered queues, exchanges, and bindings (Consumer.declare).
Enables/disables flow control on the consumer's channel (Consumer.flow).
Creates a new %Kombu.Consumer{}.
Purges all registered queues and returns the total number of purged messages (Consumer.purge).
Specifies quality of service (prefetch_size, prefetch_count, apply_global)
on the consumer's channel (Consumer.qos).
Returns the list of queues currently tracked by the consumer.
Dispatches a decoded message (body, message) to all registered callbacks (Consumer.receive).
Redelivers unacknowledged messages on the consumer's channel (Consumer.recover).
Registers a new callback fn body, message -> ... end (Consumer.register_callback).
Revives the consumer on a new channel or connection (Consumer.revive).
Executes fun.(consumer) while the consumer is active, automatically cancelling
all queue consumers when fun completes (with Consumer(...) as consumer:).
Types
@type t() :: %Kombu.Consumer{ accept: term(), active_queue_no_ack: term(), active_tags: term(), auto_declare: term(), callbacks: term(), channel: term(), connection: term(), no_ack: term(), on_decode_error: term(), on_message: term(), prefetch_count: term(), queues: term(), state_pid: term(), tag_prefix: term() }
Functions
Returns the accepted content types for this consumer.
Returns the active consumer tags map.
@spec add_queue(t(), Kombu.Queue.t()) :: {Kombu.Queue.t(), t()}
Adds a queue to the consumer without starting consumption (Consumer.add_queue).
Call consume/2 afterwards to begin consuming from the added queue.
Cancels all active queue consumers (Consumer.cancel / Consumer.close).
@spec cancel_by_queue(t(), Kombu.Queue.t() | String.t()) :: t()
Cancels consumption from a single queue and removes it from the consumer (Consumer.cancel_by_queue).
@spec channel(t()) :: Kombu.Channel.t() | function() | nil
Returns the channel or channel promise for this consumer.
Starts consuming messages from all registered queues (Consumer.consume).
@spec consuming_from?(t(), Kombu.Queue.t() | String.t()) :: boolean()
Returns true if consumer is currently consuming from queue_or_name (Consumer.consuming_from).
Declares all registered queues, exchanges, and bindings (Consumer.declare).
Enables/disables flow control on the consumer's channel (Consumer.flow).
@spec new( Kombu.Connection.t() | Kombu.Channel.t() | nil, Kombu.Queue.t() | [Kombu.Queue.t()] | nil, keyword() ) :: t()
Creates a new %Kombu.Consumer{}.
@spec purge(t()) :: non_neg_integer()
Purges all registered queues and returns the total number of purged messages (Consumer.purge).
Specifies quality of service (prefetch_size, prefetch_count, apply_global)
on the consumer's channel (Consumer.qos).
@spec queues(t()) :: [Kombu.Queue.t()]
Returns the list of queues currently tracked by the consumer.
@spec receive_message(t(), term(), Kombu.Message.t()) :: :ok
Dispatches a decoded message (body, message) to all registered callbacks (Consumer.receive).
Redelivers unacknowledged messages on the consumer's channel (Consumer.recover).
@spec register_callback(t(), (term(), Kombu.Message.t() -> term())) :: t()
Registers a new callback fn body, message -> ... end (Consumer.register_callback).
@spec revive(t(), Kombu.Connection.t() | Kombu.Channel.t()) :: t()
Revives the consumer on a new channel or connection (Consumer.revive).
Executes fun.(consumer) while the consumer is active, automatically cancelling
all queue consumers when fun completes (with Consumer(...) as consumer:).