Lepus.BasicClient (Lepus v0.1.6)
View SourceBasic Lepus.Client implementation.
Features
- Supervises
AMQP.Connectionprocess and manyAMQP.Channelprocesses (oneAMQP.Channelprocess 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(atom/0) - Required. Module name of your client. If you usedefmodule MyApp.RabbitMQ do use Lepus, client: Lepus.BasicClient endthe
nameshould beMyApp.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/1for the full list of options.:exchanges(list ofString.t/0) - List of exchange names you are going to use.Lepus.BasicClientstarts 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/4orLepus.publish_json/4withrpc: true). The default value is[].:pubsub(atom/0) - Your PubSub process name. See thePhoenix.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.