Conqueuer.Pool

Use this mixin to define a poolboy pool and supervisor.

Given you want a pool named :resolvers and will define a worker named MyApp.ResolverWorker:

defmodule MyApp.ResolversPoolSupervisor do
  use Conqueuer.Pool, name: :resolvers,
                      worker: MyApp.ResolverWorker,
                      size: 10,
                      max_overflow: 20
end

The size and max_overflow arguments are optional and if not provided the defaults are size: 1 and max_overflow: 0. For more information on these options please see the poolboy project’s documentation or this article.

Now that the :resolvers pool and supervisor is defined you will need to add it to your supervision tree.

defmodule Test do
  use Application

  def start(_type, _args) do
    import Supervisor.Spec, warn: false

    children = [
      supervisor( MyApp.ResolversPoolSupervisor, [[], [name: :ResolversPoolSupervisor]] ),
      ...
    ]

    Supervisor.start_link(children, opts)
  end
end

The name of the supervisor process is very important as it’s collaborators infer its name through convention.