Lepus.BasicClient (Lepus v0.1.0) View Source
Basic Lepus.Client
implementation.
Features
- Supervises
AMQP.Connection
process and manyAMQP.Channel
processes (oneAMQP.Channel
process per exchange). - Supports RPC
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. SeeAMQP.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
orLepus.publish_json/4
withrpc: true
). The default value is[]
.:pubsub
- Your PubSub process name. See thePhoenix.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
.