Lepus.BasicClient (Lepus v0.1.0) View Source

Basic Lepus.Client implementation.

Features

Example usage

Add it to your supervision tree

children = [
  {
    Lepus.BasicClient,
    name: MyApp.RabbitMQ,
    exchanges: ["exchange1", "exchange2"],
    connection: [
      host: "localhost",
      port: 5672,
      virtual_host: "/",
      username: "guest",
      password: "guest"
    ],
    rpc_opts: [
      pubsub: MyApp.PubSub,
      reply_to_queue: "my_app.reply_to"
    ]
  }
]

children |> Supervisor.start_link(strategy: :one_for_one)

Options

  • :name - Required. Module name of your client. If you use
defmodule MyApp.RabbitMQ do
  use Lepus, client: Lepus.BasicClient
end

the name should be MyApp.RabbitMQ.

  • :connection - Required. Defines an AMQP URI or a set of options used by the RabbitMQ client to open the connection with the RabbitMQ broker. See AMQP.Connection.open/1 for the full list of options.

  • :exchanges - List of exchange names you are going to use. Lepus.BasicClient starts and supervises separate process per exchange. Process for the default exchange ("") is always started. The default value is [].

  • :rpc_opts - Required only if you are going to use RPC (Lepus.publish/4 or Lepus.publish_json/4 with rpc: true). The default value is [].

    • :pubsub - Your PubSub process name. See the Phoenix.PubSub.
    • :reply_to_queue - Defines a queue name for the replies.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.