/publisher_pool.ex Secret
Last active
August 9, 2020 00:25
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 Pooler.PublisherPool do | |
def start_link(config) do | |
ExRabbitPool.PoolSupervisor.start_link(config, __MODULE__) | |
end | |
def connection_pools do # 1. π | |
publisher_pool = [ | |
name: {:local, :publisher_pool}, | |
worker_module: ExRabbitPool.Worker.RabbitConnection, | |
size: 1, | |
max_overflow: 0 | |
] | |
[publisher_pool] | |
end | |
def rabbitmq_config do # 2. π | |
[channels: 2] | |
end | |
def child_spec(_opts) do # 3. π | |
%{ | |
id: __MODULE__, | |
start: { | |
__MODULE__, | |
:start_link, | |
[ | |
[ | |
rabbitmq_config: rabbitmq_config(), | |
connection_pools: connection_pools() | |
] | |
] | |
}, | |
type: :supervisor | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment