Per-Worker Task that drives BridgeHolder.poll_workflow_activation/1
in a tight loop. On each {:ok, bytes} result it dispatches the
activation directly to the shared
Hourglass.WorkflowEvaluator.DynamicSupervisor, spawning a
fresh ephemeral evaluator Task per activation. The evaluator runs
once and exits :normal; Core handles redelivery on crashes.
Bridge access
This loop does NOT hold a raw bridge handle. Every iteration calls
BridgeHolder.poll_workflow_activation(task_queue) and the
Application-level holder mediates the NIF call (dispatching the
long-poll to its own child Task and replying when Core delivers).
Shutdown
When BridgeHolder.poll_workflow_activation/1 returns
{:error, %Bridge.Error{kind: :shutdown}} the loop disambiguates
via BridgeHolder.registered?/1:
registered?→ false: the Worker is being torn down (gracefulWorker.terminate/2already calledunregister_worker). Exit:normaland let the inner Supervisor reap the loop.registered?→ true: the holder recycled the bridge handle mid-flight (poll-caller DOWN). Sleep briefly + retry against the new handle.
If the call returns {:error, :worker_not_registered} the loop
treats it as a transient retry condition (sleep + retry) —
registration may be in flight, e.g. the holder restarted moments
ago and Worker.Supervisor.start_worker/1's register call hasn't
completed yet.
Other bridge errors log + sleep + retry. The Supervisor's
:transient restart for this child means :normal exit is final
(no flapping during graceful shutdown).
Summary
Types
Options accepted by start_link/1.
Functions
Loop entry. Iterates BridgeHolder.poll_workflow_activation/1
until shutdown.
Spawn a linked Task that runs the poll loop until the bridge
reports :shutdown or the parent supervisor terminates it.
Types
@type opts() :: [{:task_queue, String.t()}]
Options accepted by start_link/1.