Squidie.Runtime.ScheduleIdentity (squidie v0.1.2)

Copy Markdown View Source

Builds stable identities for scheduled workflow activations.

Cron delivery has to survive worker retries, duplicate job delivery, and code deploys between the time a scheduler queues an activation and the time Squidie receives it. This module keeps the scheduler-supplied or derived signal identity independent from the current workflow definition so an already persisted scheduled run can still be found after workflow code drifts.

Summary

Functions

Derives the deterministic run id used to fence one scheduled activation.

Returns the scheduler signal id from the payload or derives one from a window.

Functions

run_id(workflow, trigger, signal_id)

@spec run_id(String.t(), String.t(), String.t()) ::
  {:ok, Ecto.UUID.t()} | {:error, {:invalid_schedule_identity, term()}}

Derives the deterministic run id used to fence one scheduled activation.

The inputs are serialized workflow and trigger names plus a stable signal id.

signal_id(workflow, trigger, payload)

@spec signal_id(String.t(), String.t(), map()) :: {:ok, String.t()} | {:error, term()}

Returns the scheduler signal id from the payload or derives one from a window.