JoobQ.Supervisor (joobq_ex v0.8.0)

Copy Markdown View Source

The processes of one JoobQ instance: the Finch pool its gateway calls go through and, when :queues is given, the worker's. Start it in the host application's supervision tree with {JoobQ, url: ..., token: ...} (see JoobQ.Config for the options).

Its child specification is restart: :transient. When the gateway refuses this SDK's version (426, see JoobQ.SdkTooOldError) the instance stops with {:shutdown, %JoobQ.SdkTooOldError{}}, and the host's supervisor does not restart it (each restart would only be refused again); the rest of the host's tree keeps running, without the instance. A normal stop (:normal, :shutdown) is not restarted either, and a crash is, as OTP defines for a transient child. A host that must not run without the instance monitors it (Process.monitor/1 on Process.whereis(name), name being the instance's :name, JoobQ by default) and stops itself on that :DOWN (for example with System.stop(1)); a host that keeps running without it needs nothing more. To have the instance restarted anyway, override it: Supervisor.child_spec({JoobQ, opts}, restart: :permanent) (the host's supervisor then gives up once its restart intensity is reached).

Summary

Functions

The configuration of the running instance name; raises ArgumentError when it is not started.

Starts the instance described by config (a JoobQ.Config or its options).

Functions

config(name)

@spec config(atom()) :: JoobQ.Config.t()

The configuration of the running instance name; raises ArgumentError when it is not started.

start_link(config)

@spec start_link(JoobQ.Config.t() | keyword()) :: Supervisor.on_start()

Starts the instance described by config (a JoobQ.Config or its options).