Lapin.Producer behaviour (lapin v1.0.4) View Source
Extensible behaviour to define producer configuration.
Lapin provides a number of submodules which implement the patterns found in the RabbitMQ Tutorials.
defmodule ExampleApp.SomePatter do
use Lapin.Producer
[... callbacks implementation ...]
end
Link to this section Summary
Callbacks
Request publisher confirms (RabbitMQ only)
Declare exchange
Request message mandatory routing when publishing
Request message persistence when publishing
Functions
Wait for publish confirmation
Creates a producer from configuration
Find consumer by consumer_tag
Publish message
Link to this section Types
Specs
config() :: Keyword.t()
Producer configuration
The following keys are supported:
- pattern: producer pattern (module using the
Lapin.Producer
behaviour)
If using the Lapin.Producer.Config
default implementation, the following keys are also supported:
- exchange: exchange used for publish (
String.t
, required) - confirm: expect RabbitMQ publish confirms (
boolean()
, default: false) - mandatory: messages published as mandatory by default (
boolean()
, default: false) - persistent: messages published as persistent by default (
boolean()
, default: false)
Specs
t() :: %Lapin.Producer{ channel: AMQP.Channel.t(), config: config(), exchange: String.t(), pattern: atom() }
Lapin Producer
Link to this section Callbacks
Specs
Request publisher confirms (RabbitMQ only)
Specs
exchange(producer :: t()) :: Lapin.Exchange.t()
Declare exchange
Specs
Request message mandatory routing when publishing
Specs
Request message persistence when publishing
Link to this section Functions
Specs
Wait for publish confirmation
Specs
create(AMQP.Connection.t(), config()) :: t()
Creates a producer from configuration
Specs
Find consumer by consumer_tag
Specs
publish( t(), Lapin.Exchange.name(), Lapin.Exchange.routing_key(), Lapin.Message.payload(), Keyword.t() ) :: :ok | {:error, term()}
Publish message