Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bleacherreport/carrot
AMQP Connection Manager
https://github.com/bleacherreport/carrot
amqp connection-manager elixir rabbitmq
Last synced: 26 days ago
JSON representation
AMQP Connection Manager
- Host: GitHub
- URL: https://github.com/bleacherreport/carrot
- Owner: bleacherreport
- License: apache-2.0
- Created: 2018-06-12T21:12:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-09T15:57:57.000Z (over 6 years ago)
- Last Synced: 2024-11-29T12:34:31.022Z (about 1 month ago)
- Topics: amqp, connection-manager, elixir, rabbitmq
- Language: Elixir
- Homepage:
- Size: 40 KB
- Stars: 7
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Carrot
> AMQP connection manager
[![Build Status](https://www.travis-ci.org/bleacherreport/carrot.svg?branch=master)](https://www.travis-ci.org/bleacherreport/carrot)
[![codecov](https://codecov.io/gh/bleacherreport/carrot/branch/master/graph/badge.svg)](https://codecov.io/gh/bleacherreport/carrot)## Installation
The package can be installed by adding `carrot` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:carrot, "~> 1.0"}]
end
```## Configuration and startup
Carrot 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`:```elixir
{:ok, pid} = Carrot.ConnectionManager.start_link([
host: "localhost",
password: "guest",
username: "guest",
virtual_host: "/"
])
```## Supervision
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](https://hexdocs.pm/elixir/GenServer.html#t:option/0).See [Name Registration](https://hexdocs.pm/elixir/GenServer.html#module-name-registration)
for more details.```elixir
...
worker(Carrot.ConnectionManager, [
[
host: "localhost",
password: "guest",
username: "guest",
virtual_host: "/"
],
[
name: Carrot.ConnectionManager
]
]),
...
```## Potential gotchas
If your application dependends on `cowboy` at `v1.x`, you may need to add a
dependency override for `ranch`:```elixir
{: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`:```elixir
# mix.exs
def application do
[applications: [:lager, :logger]]
end
```You can also silence `lager` by setting its log level to `critical`:
```elixir
config :lager,
handlers: [level: :critical]
```## Documentation
Documentation can be be found on [HexDocs](https://hexdocs.pm/carrot).