Hourglass.Worker.ActivityPollLoop (hourglass v0.1.0)

Copy Markdown View Source

Per-Worker Task that drives BridgeHolder.poll_activity_task/1 in a tight loop. Each {:ok, bytes} is decoded into a Coresdk.ActivityTask.ActivityTask and dispatched directly to Hourglass.ActivityExecutor.DynamicSupervisor.start_child/1 (the shared Application-level executor DynSup).

Bridge access

This loop does NOT hold a raw bridge handle. It calls BridgeHolder.poll_activity_task(task_queue) and the Application-level holder mediates the NIF call.

Shutdown

Same shape as WorkflowPollLoop: :shutdown from the bridge is disambiguated against BridgeHolder.registered?/1 — exit :normal if the holder no longer has a handle (graceful Worker teardown), sleep + retry if it still does (handle recycle). :worker_not_registered → brief sleep + retry; other errors → log

  • sleep + retry.

Summary

Types

Options accepted by start_link/1.

Functions

Loop entry. Iterates BridgeHolder.poll_activity_task/1 until shutdown.

Types

opts()

@type opts() :: [{:task_queue, String.t()}]

Options accepted by start_link/1.

Functions

run(opts)

@spec run(opts()) :: :ok

Loop entry. Iterates BridgeHolder.poll_activity_task/1 until shutdown.

start_link(opts)

@spec start_link(opts()) :: {:ok, pid()}