View Source AMQP.SelectiveConsumer (amqp v3.2.0)

This is an Elixir reimplementation of :amqp_selective_consumer - source.

The module is used by default when you open a channel via AMQP.Channel.open/2 and allows you to end consumer processes via AMQP.Basic.consume/4 and receive messages from a queue.

Usually you don't have to pay attention to this module as the interaction would be made through AMQP.Channel.open/2, AMQP.Basic.consume/4, AMQP.Basic.return/2, AMQP.Confirm.register_handler/2 etc.

Link to this section Summary

Link to this section Types

@type t() :: %AMQP.SelectiveConsumer{
  confirm_handler: term(),
  consumers: %{required(String.t()) => pid()},
  default_consumer: pid() | :none,
  monitors: %{required(pid()) => {integer(), reference()}},
  return_handler: pid() | :none,
  unassigned: pid() | :undefined
}

Link to this section Functions

Link to this function

register_default_consumer(channel, consumer_pid)

View Source
@spec register_default_consumer(AMQP.Channel.t(), pid()) :: :ok

Ported from :amqp_selective_consumer.register_default_consumer/2.

This function registers a default consumer with the channel.

A default consumer is used when a subscription is made via amqp_channel:call(ChannelPid, #'basic.consume'{}) (rather than {@module}:subscribe/3) and hence there is no consumer pid registered with the consumer tag. In this case, the relevant deliveries will be sent to the default consumer.