View Source WorkflowMetal.Registration.Adapter behaviour (workflow_metal v0.2.1)

Defines a behaviour for a process registry to be used by WorkflowMetal.

By default, WorkflowMetal will use a local process registry, defined in WorkflowMetal.Registration.LocalRegistry, that uses Elixir's Registry module for local process registration. This limits WorkflowMetal to only run on a single node. However the WorkflowMetal.Registration behaviour can be implemented by a library to provide distributed process registration to support running on a cluster of nodes.

Link to this section Summary

Callbacks

Return a supervisor spec for the registry

Start a child under a DynamicSupervisor. If a child with give name already exists, find its pid.

Return a :via tuple to route a message to a process by its registered name

Get the pid of a registered name.

Link to this section Types

Specs

adapter_meta() :: map()

Specs

application() :: WorkflowMetal.Application.t()

Specs

child_spec() :: module() | {module(), term()}

Specs

config() :: keyword()

Specs

on_start_child() :: {:ok, pid()} | {:error, term()}

Link to this section Callbacks

Link to this callback

child_spec(application, config)

View Source

Specs

child_spec(application(), config()) ::
  {:ok, :supervisor.child_spec() | {module(), term()} | module(),
   adapter_meta()}

Return a supervisor spec for the registry

Link to this callback

start_child(adapter_meta, name, supervisor, child_spec)

View Source

Specs

start_child(
  adapter_meta :: adapter_meta(),
  name :: term(),
  supervisor :: Supervisor.supervisor(),
  child_spec :: child_spec()
) :: on_start_child()

Start a child under a DynamicSupervisor. If a child with give name already exists, find its pid.

Link to this callback

via_tuple(adapter_meta, name)

View Source

Specs

via_tuple(adapter_meta :: adapter_meta(), name :: term()) ::
  {:via, module(), term()}

Return a :via tuple to route a message to a process by its registered name

Link to this callback

whereis_name(adapter_meta, name)

View Source

Specs

whereis_name(adapter_meta(), name :: term()) :: pid() | :undefined

Get the pid of a registered name.

Returns :undefined if the name is unregistered.