ecto_job v2.1.0 EctoJob.Supervisor View Source

Job Queue supervisor that can be started with client applications.

The EctoJob.Supervisor will start the required processes to listen for postgres job notifications, GenStage producer and ConsumerSupervisor to process the jobs.

Example:

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

  children = [
    supervisor(MyApp.Repo, []),
    supervisor(MyApp.Endpoint, []),
    supervisor(EctoJob.Supervisor, [[
      name: MyAppJobQueue,
      app: :my_app,
      repo: MyApp.Repo,
      schema: MyApp.JobQueue,
      max_demand: 100]])
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end

Link to this section Summary

Functions

Starts an EctoJob queue supervisor

Link to this section Functions

Link to this function

start_link(config) View Source
start_link(EctoJob.Config.t()) :: {:ok, pid()}

Starts an EctoJob queue supervisor