Last active
May 14, 2017 11:20
-
-
Save gottfrois/9577513374a075ab2e7e667c948068e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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