Lapin.Consumer behaviour (lapin v1.0.3) View Source
Extensible behaviour to define consumer configuration.
Lapin provides a number of submodules which implement the patterns found in the RabbitMQ Tutorials.
defmodule ExampleApp.SomeConsumer do
use Lapin.Consumer
[... callbacks implementation ...]
end
Link to this section Summary
Functions
ACK message consumption
Creates a consumer from configuration
Find consumer by consumer_tag
Reject message
Link to this section Types
Specs
config() :: Keyword.t()
Consumer configuration
The following keys are supported:
- pattern: producer pattern (module using the
Lapin.Producer
behaviour)
If using the Lapin.Consumer.Config
default implementation, the following keys are also supported:
- queue: queue to consume from, (
String.t()
, required) - ack: producer ack (
boolean()
, default: false* - prefetch_count: consumer prefetch count (
integer()
, default: 1)
Specs
consumer_tag() :: String.t()
Consumer Tag
Specs
prefetch_count() :: integer()
Consumer Prefetch
Specs
t() :: %Lapin.Consumer{ channel: AMQP.Channel.t(), config: config(), consumer_tag: consumer_tag(), pattern: atom(), queue: String.t() }
Lapin Consumer Behaviour
Link to this section Functions
Specs
ACK message consumption
Specs
create(AMQP.Connection.t(), config()) :: t()
Creates a consumer from configuration
Specs
get([t()], consumer_tag()) :: {:ok, t()} | {:error, :not_found}
Find consumer by consumer_tag
Specs
Reject message
Link to this section Callbacks
Specs
Consumer acknowledgements enabled
Specs
prefetch_count(consumer :: t()) :: prefetch_count()
Consumer message prefetch count
Specs
queue(consumer :: t()) :: Lapin.Queue.t()
Queue to consume from