Lapin.Producer behaviour (lapin v1.0.3) 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

Types

Producer configuration

t()

Lapin Producer

Functions

Wait for publish confirmation

Creates a producer from configuration

Find consumer by consumer_tag

Callbacks

Request publisher confirms (RabbitMQ only)

Declare exchange

Request message mandatory routing when publishing

Request message persistence when publishing

Link to this section Types

Specs

config() :: Keyword.t()

Producer configuration

The following keys are supported:

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 Functions

Specs

confirm(t()) :: boolean()

Wait for publish confirmation

Link to this function

create(connection, config)

View Source

Specs

create(AMQP.Connection.t(), config()) :: t()

Creates a producer from configuration

Link to this function

get(producers, exchange)

View Source

Specs

get([t()], String.t()) :: {:ok, t()} | {:error, :not_found}

Find consumer by consumer_tag

Link to this function

publish(map, exchange, routing_key, payload, options)

View Source

Specs

Publish message

Link to this section Callbacks

Specs

confirm(producer :: t()) :: boolean()

Request publisher confirms (RabbitMQ only)

Specs

exchange(producer :: t()) :: Lapin.Exchange.t()

Declare exchange

Specs

mandatory(producer :: t()) :: boolean()

Request message mandatory routing when publishing

Specs

persistent(producer :: t()) :: boolean()

Request message persistence when publishing