AMQP connection manager
The package can be installed by adding carrot to your list of dependencies in mix.exs:
def deps do
[{:carrot, "~> 1.0"}]
endCarrot does not use Mix or Application configuration. The ConnectionManager
simply takes a Keyword list of connection options as the first argument to
start_link/2:
{:ok, pid} = Carrot.ConnectionManager.start_link([
host: "localhost",
password: "guest",
username: "guest",
virtual_host: "/"
])The ConnectionManager is meant to be started as part of a supervision tree.
Therefore, it is most common to register the process with a name. The second
argument to start_link/2 is a list of GenServer
options.
See Name Registration for more details.
...
worker(Carrot.ConnectionManager, [
[
host: "localhost",
password: "guest",
username: "guest",
virtual_host: "/"
],
[
name: Carrot.ConnectionManager
]
]),
...If your application dependends on cowboy at v1.x, you may need to add a
dependency override for ranch:
{:ranch, "~> 1.4", override: true}It appears there are no breaking changes between ranch 1.3 and 1.5.
Another issue you might come across is from a dependency on lager. You may
need to ensure that lager is started before Elixir's logger:
# mix.exs
def application do
[applications: [:lager, :logger]]
endYou can also silence lager by setting its log level to critical:
config :lager,
handlers: [level: :critical]Documentation can be be found on HexDocs.