View Source Lapin.Producer behaviour (lapin v1.0.7)
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
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
Types
@type 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)
@type t() :: %Lapin.Producer{ channel: AMQP.Channel.t(), config: config(), exchange: String.t(), pattern: atom() }
Lapin Producer
Callbacks
Request publisher confirms (RabbitMQ only)
@callback exchange(producer :: t()) :: Lapin.Exchange.t()
Declare exchange
Request message mandatory routing when publishing
Request message persistence when publishing
Functions
Wait for publish confirmation
@spec create(AMQP.Connection.t(), config()) :: t()
Creates a producer from configuration
Find consumer by consumer_tag
@spec publish( t(), Lapin.Exchange.name(), Lapin.Exchange.routing_key(), Lapin.Message.payload(), Keyword.t() ) :: :ok | {:error, term()}
Publish message