Enrollment lifecycle context.
Summary
Functions
Enrolls a subscriber into the active sequence version and schedules the first step.
Deprecated unscoped lookup. Use get_enrollment/4 with an explicit tenant key.
Finds one enrollment by sequence, subscriber identity, and explicit tenant scope.
Lists active enrollments with an explicit tenant scope and optional sequence filter.
Deprecated unscoped pause. Use pause_enrollment/2 with an explicit tenant key.
Pauses an enrollment scoped by tenant and cancels any pending scheduled executions.
Reassigns an outbound enrollment to a different adapter without changing in-flight executions.
Deprecated unscoped resume. Use resume_enrollment/2 with an explicit tenant key.
Resumes a paused enrollment scoped by tenant and schedules the next unsent step.
Deprecated unscoped event tracking by enrollment id. Use track_event/4.
Records a subscriber event for a tenant-scoped enrollment and schedules matching event-triggered steps. Raises if the enrollment is not in the given tenant scope.
Deprecated unscoped cancel. Use unenroll/2 with an explicit tenant key.
Cancels an enrollment scoped by tenant and any pending scheduled executions.
Functions
@spec enroll(map()) :: {:ok, Ecto.Schema.t()} | {:error, term()}
Enrolls a subscriber into the active sequence version and schedules the first step.
@spec get_enrollment(Ecto.UUID.t(), binary(), binary()) :: no_return()
Deprecated unscoped lookup. Use get_enrollment/4 with an explicit tenant key.
@spec get_enrollment(Ecto.UUID.t(), binary(), binary(), binary() | nil) :: Ecto.Schema.t() | nil
Finds one enrollment by sequence, subscriber identity, and explicit tenant scope.
@spec list_active_enrollments(map()) :: [Ecto.Schema.t()]
Lists active enrollments with an explicit tenant scope and optional sequence filter.
@spec pause_enrollment(Ecto.UUID.t()) :: no_return()
Deprecated unscoped pause. Use pause_enrollment/2 with an explicit tenant key.
@spec pause_enrollment(Ecto.UUID.t(), binary() | nil) :: {:ok, Ecto.Schema.t()} | {:error, term()}
Pauses an enrollment scoped by tenant and cancels any pending scheduled executions.
@spec repin_enrollment(Ecto.UUID.t(), Ecto.UUID.t(), keyword() | map()) :: {:ok, Ecto.Schema.t()} | {:error, term()}
Reassigns an outbound enrollment to a different adapter without changing in-flight executions.
Requires an explicit :tenant_key in opts and validates that new_adapter_id
belongs to the same tenant, is active, and is in a usable health state.
@spec resume_enrollment(Ecto.UUID.t()) :: no_return()
Deprecated unscoped resume. Use resume_enrollment/2 with an explicit tenant key.
@spec resume_enrollment(Ecto.UUID.t(), binary() | nil) :: {:ok, Ecto.Schema.t()} | {:error, term()}
Resumes a paused enrollment scoped by tenant and schedules the next unsent step.
@spec track_event(Ecto.UUID.t() | map(), binary(), map()) :: {:ok, Ecto.Schema.t() | map()} | {:error, Ecto.Changeset.t()} | no_return()
Deprecated unscoped event tracking by enrollment id. Use track_event/4.
@spec track_event(Ecto.UUID.t(), binary(), map(), binary() | nil) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
Records a subscriber event for a tenant-scoped enrollment and schedules matching event-triggered steps. Raises if the enrollment is not in the given tenant scope.
@spec unenroll(Ecto.UUID.t()) :: no_return()
Deprecated unscoped cancel. Use unenroll/2 with an explicit tenant key.
@spec unenroll(Ecto.UUID.t(), binary() | nil) :: {:ok, Ecto.Schema.t()} | {:error, term()}
Cancels an enrollment scoped by tenant and any pending scheduled executions.