Protein v0.8.0 Protein.AMQPAdapter View Source

Transports RPC calls through AMQP messaging queue.

Usage

In order to use this adapter in your client, use the following code:

defmodule MyProject.RemoteRPC do
  use Protein.Client

  transport :amqp,
    url: "amqp://example.com",
    queue: "remote_rpc",
    timeout: 15_000,
    reconnect_interval: 1_000

  # ...
end

In order to use this adapter in your server, use the following code:

defmodule MyProject.MyRPC do
  use Protein.Server

  transport :amqp,
    url: "amqp://example.com",
    queue: "my_rpc",
    concurrency: 5,
    reconnect_interval: 5_000

  # ...
end

You can also configure the adapter per environment in your Mix config as follows:

config :my_project, MyProject.MyRPC,
  transport: [adapter: :amqp,
              url: {:system, "MY_RPC_AMQP_URL"},
              queue: {:system, "MY_RPC_AMQP_QUEUE"}]