Hourglass.WorkerLauncher (hourglass v0.1.0)

Copy Markdown View Source

Boot-time supervisor child that starts the default Elixir Temporal worker — the one that polls the "default" task queue.

Lives inside Hourglass.Subsystem (:rest_for_one) as the last child. On a BridgeHolder crash, the cascade restarts WorkerRegistry, Worker.Supervisor, then this module — which re-invokes Worker.Supervisor.start_worker/1 and re-establishes the default Worker against the fresh subtree. No zombie state.

Returns :ignore from start_link/0 so no process lingers; the Worker's own GenServer (registered under Worker.Supervisor) carries the runtime state.

Structural dispatch — no module registration

The default Worker needs only a task queue. Workflow and activity modules are resolved purely structurally at dispatch time: the Temporal type name on the wire is Atom.to_string(module) (e.g. "Elixir.MyApp.Workflows.Hello"), so the worker recovers the module atom via String.to_existing_atom/1 and verifies it is a loaded Hourglass workflow or activity by checking for the __workflow_input_type__/0 / __activity_input_type__/0 marker generated by use Hourglass.Workflow / use Hourglass.Activity. No config :hourglass, :workflows / :activities lists are needed.

Disabling

Set config :hourglass, :start_default_worker, false to skip registration. Tests use this so per-test Workers (started via Worker.Supervisor.start_worker/1 with unique task queues) own worker lifecycle without contention from a global default.

Summary

Functions

child_spec(opts)

@spec child_spec(term()) :: Supervisor.child_spec()

start_link()

@spec start_link() :: :ignore | {:error, term()}