View Source Lepus.BasicClient (Lepus v0.1.5)

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 (atom/0) - 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 String.t/0) - 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 (keyword/0) - 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 (atom/0) - Your PubSub process name. See the Phoenix.PubSub.

    • :reply_to_queue (String.t/0) - Defines a queue name for the replies.

    • :queues_type - Defines reply_to queue type (one of ["classic", "quorum"]). Used during queue declaration.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.