Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gottfrois/9577513374a075ab2e7e667c948068e4 to your computer and use it in GitHub Desktop.
Save gottfrois/9577513374a075ab2e7e667c948068e4 to your computer and use it in GitHub Desktop.
defmodule Rabbit.ConnectionPool do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init(_) do
pool_options = [
{:name, {:local, :rabbit_connection_pool}},
{:worker_module, Rabbit.ConnectionWorker},
{:size, 1},
{:max_overflow, 5}
]
children = [
:poolboy.child_spec(:rabbit_connection_pool, pool_options, %{
host: "localhost",
port: 5672,
})
]
supervise children, strategy: :one_for_one
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment