ecto_job v0.2.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(list) View Source
start_link(repo: module(), schema: module(), max_demand: integer()) ::
  {:ok, pid()}

Starts an EctoJob queue supervisor

  • repo : Ecto Repo module
  • schema : EctoJob.JobQueue Module for the schema representing the queue
  • max_demand : Sets the maximum concurrency for job workers