Skip to content

Instantly share code, notes, and snippets.

@octosteve
Last active August 9, 2020 00:25
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