ChromicPDF.Supervisor (ChromicPDF v0.6.0) View Source

Use this for multiple ChromicPDF instances.

When is this useful?

  • You want to completely separate two or more PDF worker pools
  • You want to give your PDF module a custom API

Usage

defmodule MyApp.MyPDFGenerator do
  use ChromicPDF.Supervisor
end

def MyApp.Application do
  def start(_type, _args) do
    children = [
      MyApp.MyPDFGenerator
    ]

    Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
  end
end

Link to this section Summary

Functions

Returns a specification to start this module as part of a supervision tree.

Fetches pids of the supervisor's services and passes them to the given callback function.

Link to this section Types

Specs

services() :: %{browser: pid(), ghostscript_pool: pid()}

Link to this section Functions

Link to this function

child_spec(chromic, config)

View Source

Returns a specification to start this module as part of a supervision tree.

Link to this function

with_services(chromic, fun)

View Source

Specs

with_services(module(), (services() -> any())) :: any()

Fetches pids of the supervisor's services and passes them to the given callback function.

If the supervisor has not been started but configured to run in on_demand mode, this will start a temporary supervision tree.