View Source Oban.Registry (Oban v2.14.0)

Local process storage for Oban instances.

Link to this section Summary

Functions

Fetch the config for an Oban supervisor instance.

Find the {pid, value} pair for a registered Oban process.

Build a via tuple suitable for calls to a supervised Oban process.

Returns the pid of a supervised Oban process, or nil if the process can't be found.

Link to this section Types

@type key() :: Oban.name() | {Oban.name(), role()}
@type role() :: term()
@type value() :: term()

Link to this section Functions

@spec config(Oban.name()) :: Oban.Config.t()

Fetch the config for an Oban supervisor instance.

example

Example

Get the default instance config:

Oban.Registry.config(Oban)

Get config for a custom named instance:

Oban.Registry.config(MyApp.Oban)
Link to this function

lookup(oban_name, role \\ nil)

View Source
@spec lookup(Oban.name(), role()) :: nil | {pid(), value()}

Find the {pid, value} pair for a registered Oban process.

example

Example

Get the default instance config:

Oban.Registry.lookup(Oban)

Get a supervised module's pid:

Oban.Registry.lookup(Oban, Oban.Notifier)
Link to this function

via(oban_name, role \\ nil, value \\ nil)

View Source
@spec via(Oban.name(), role(), value()) :: {:via, Registry, {Oban.Registry, key()}}

Build a via tuple suitable for calls to a supervised Oban process.

example

Example

For an Oban supervisor:

Oban.Registry.via(Oban)

For a supervised module:

Oban.Registry.via(Oban, Oban.Notifier)

For a plugin:

Oban.Registry.via(Oban, {:plugin, Oban.Plugins.Cron})
Link to this function

whereis(oban_name, role \\ nil)

View Source
@spec whereis(Oban.name(), role()) :: pid() | nil

Returns the pid of a supervised Oban process, or nil if the process can't be found.

example

Example

Get the Oban supervisor's pid:

Oban.Registry.whereis(Oban)

Get a supervised module's pid:

Oban.Registry.whereis(Oban, Oban.Notifier)

Get the pid for a plugin:

Oban.Registry.whereis(Oban, {:plugin, MyApp.Oban.Plugin})

Get the pid for a queue's producer:

Oban.Registry.whereis(Oban, {:producer, "default"})