Skip to content

All-Serverless Durable Coordinator ​

Historical design and proof snapshot

This page preserves the original design/proof stage, including its audit and proposed implementation slices. References below to missing handlers, deferred continuation scheduling and future hosting describe that stage, not current support. AWS Durable is now the preferred AWS coordination host under ADR-0069, and the host includes SQS transition-worker Lambda handlers. Use AWS Durable Coordination for the deployment contract and the production completion plan for remaining qualification gates. The historical local proof is not itself production deployment evidence.

The original design track asked one question: can TPF keep QUEUE_ASYNC semantics without a long-running coordinator process?

The working hypothesis was probably yes, but not by making a Lambda, Azure Function, or Cloud Run function "durable" by itself. The coordinator must be decomposed into single-shot actions that can be invoked by APIs, queues, event sources, and schedulers. Durable cloud services own wakeups and storage; TPF still owns execution semantics.

PR 1 provides the action contract: PipelineControlPlane exposes the existing bounded coordinator operations plus an explicit sweepOnce action with a structured result. PR 2 separates the compute-first sweep and SQS polling loops from the bounded actions they host. PR 3 proves those boundaries locally against AWS-shaped DynamoDB and SQS substrates without hosting the compute-first loops. The durable workflow adapter spike then proves that an AWS Lambda durable execution can drive those actions without taking authority from TPF. At this proof stage, FUNCTION support covered serverless invocation/adapters; provider handlers and fully serverless hosting were follow-up work.

Recommendation at the proof stage ​

Use one TPF-native single-shot coordinator action model with replaceable coordination hosts.

The proof identified AWS Lambda Durable Functions as the preferred candidate AWS host because the deployed fault proof shows it can own mechanical liveness without taking semantic authority. Other provider engines remain candidates only if they preserve TPF's control-plane invariants:

  1. execution identity and idempotent submit,
  2. await unit identity and external completion admission,
  3. pinned pipeline contract and release version,
  4. worker identity and release compatibility checks,
  5. DLQ/re-drive evidence and operator control,
  6. at-least-once transition execution with stable business idempotency keys.

Provider handlers can now invoke the bounded SQS message actions without reproducing work-item, await-completion, or transition-worker semantics. At that stage, a complete process-free deployment still needed a durable replacement for itemised await-continuation retry scheduling.

The durable workflow spike and deployed proof establish a deeper driver: AWS owns checkpoints, suspension, callback durability, and stream-triggered wake-up, while generation-fenced callback state remains mechanical. A replacement provider execution reconstructs from the TPF semantic checkpoint without redispatching work. Provider retry, DLQ, and re-drive primitives still do not replace TPF's contracts. See AWS Durable Coordination Host.

Target Shape ​

This is the target hosting shape. The current compute-first runtime retains its sweeper and SQS polling loops as replaceable loop hosts. Each host adapts a bounded action and owns only receiving, acknowledgement, visibility, scheduling, concurrency, and backoff.

Current compute-first roleAll-serverless equivalent
Hosted control-plane resourceAPI/function handler for submit, status, result, await completion, admin, and re-drive
SQS work poller threadQueue event-source invocation or explicit processWorkItem action
Queue sweeper threadScheduled sweepOnce invocation
Await completion pollerProvider event-source invocation or explicit completeAwait action
Transition worker processStateless function that handles one transition envelope
Worker lifecycle heartbeatExplicit heartbeat action or platform-deployment registration action

AWS-Shaped Local Proof ​

The runtime integration proof uses LocalStack DynamoDB and SQS as durable substrates, but invokes the coordinator and message actions directly. A bounded test driver receives one event, calls one action, and acknowledges only an ACKNOWLEDGE disposition. It does not start the work, await-completion, transition-worker, or sweep loop hosts.

The proof covers:

  1. submit, signed SQS transition dispatch, durable await suspension, process replacement, replay of the original work event, await completion, resume, and typed/raw result reads;
  2. a synthetic scheduled wakeup that calls sweepOnce(nowEpochMs), dispatches one due retry, and returns the structured sweep counts;
  3. terminal worker failure, SQS DLQ publication, process replacement, operator re-drive, and successful completion while preserving the pinned pipeline, contract, and release identity.

This is deliberately an AWS-shaped local proof, not production AWS function support. DynamoDB and SQS behaviour is exercised through their AWS SDK contracts. The scheduled wakeup is an event-shaped call made by the test driver; it is not an EventBridge rule or handler. Lambda handlers, EventBridge integration, IAM and deployment templates were outside this local proof; consult the current host documentation for implemented packaging and remaining deployment work.

Single-Shot Action Sequences ​

Submit ​

This action is already close to single-shot. It creates the execution and enqueues work before returning.

Claim And Dispatch ​

This requires worker selection to be explicit and no accidental local fallback in the coordinator action.

Await Completion ​

The normal parent-release path is mostly single-shot. Aggregate item continuations are not clean yet because current code can schedule in-process retry attempts.

Sweep And Retry Wakeup ​

PipelineControlPlane.sweepOnce(long nowEpochMs) is now the explicit action boundary. It returns Uni<CoordinatorSweepResult> with the supplied timestamp, configured sweep limit, successfully admitted await timeout count, and successfully dispatched execution count. It processes await timeouts before querying and dispatching due executions. Any phase failure fails the Uni; dispatch attempts the complete due batch before reporting aggregated failures.

The compute-first lifecycle remains the default, but loop ownership has moved to QueueAsyncSweepLoopHost. It obtains the current time, invokes sweepOnce, subscribes once, discards the successful summary, and logs failure. QueueAsyncCoordinator now initialises providers without scheduling. The configured pipeline.orchestrator.sweep-limit remains authoritative.

Re-drive ​

This is already close to single-shot. It must preserve pinned pipeline, contract, and release identity.

QueueAsyncCoordinator Decomposability Audit ​

This is the proof-stage audit, retained as design history; it is not a fresh audit of the merged host.

AreaCurrent shapeSingle-shot readinessRequired change
SubmitexecutePipelineAsync creates execution and enqueues workCleanAvailable through PipelineControlPlane; action invocation initializes providers without starting loops.
StatusgetExecutionStatus reads durable recordCleanNo meaningful change.
ResultgetExecutionResult / payload reads durable recordCleanNo meaningful change.
Re-driveredriveExecution conditionally transitions terminal execution and enqueues workCleanAvailable through PipelineControlPlane with its existing explicit result.
Process work itemprocessExecutionWorkItem admits, claims, invokes worker, commits outcomeMostly cleanInject selected worker explicitly; require remote/function worker when running as serverless coordinator.
Await completioncompleteAwait admits completion and releases parent executionPartly cleanKeep parent release action; convert aggregate item continuations and retries into explicit queued actions.
SweepsweepOnce(nowEpochMs) is reactive and returns CoordinatorSweepResult; QueueAsyncSweepLoopHost owns the compute-first scheduleCleanAdd provider scheduler handlers in a later slice.
Await item continuationUses executor scheduling and fire-and-forget retry attemptsNot cleanRepresent continuation attempts as durable work items or scheduler wakeups.
Work pollerSqsWorkPoller hosts receiving, acknowledgement, visibility, and backoff over SqsWorkItemActionClean message actionReuse the action from a provider event-source handler.
Await completion pollerSqsAwaitCompletionPoller hosts bounded concurrent receives and acknowledgement over SqsAwaitCompletionActionClean message actionReuse the action from a provider event-source handler.
SQS transition worker pollerSqsTransitionWorkerPoller hosts receiving and acknowledgement over SqsTransitionWorkerActionClean message actionReuse the action from a provider event-source worker function.

PipelineControlPlane is now the single-shot action contract for submit, status, typed/raw result, re-drive, work-item processing, await completion, pending-await queries, and one bounded sweep. SqsWorkItemAction, SqsAwaitCompletionAction, and SqsTransitionWorkerAction add receipt-independent message boundaries for provider event sources. Provider initialisation is separate from loop startup, so invoking an action does not start the periodic sweeper. The remaining work identified by this audit was aggregate await-continuation retry scheduling and provider-specific hosting.

Provider Durable Workflow Shortcuts ​

Provider durable workflow engines may reduce implementation effort, but they are not drop-in replacements for TPF coordinator semantics.

The adapter spike tests AWS Lambda Durable Functions with its Java local runner. It checkpoints submit, dispatch-to-await, callback wait, and resume/result operations around the existing TPF actions. Provider checkpoint loss replays through the stable TPF execution key without duplicating the signed worker transition. Await completion is admitted by TPF before a DynamoDB Stream wake-up completes the current generation's provider callback. A replacement durable execution can attach to the same parked TPF execution, and stale callback generations are ignored.

Backend optionValueTPF risk
AWS Lambda durable functionsAWS documents checkpoint/replay, waits, retries, and long-running durable executions in Lambda code. Useful if TPF can compile coordinator logic into durable operations.AWS owns replay/history semantics; TPF must map await units, release pinning, re-drive, and worker identity without creating a second inconsistent state machine.
AWS Step Functions / durable functions comparisonMature AWS workflow orchestration with explicit state-machine visibility.TPF pipeline semantics would need to compile into provider workflow definitions; provider history/retry/DLQ semantics may become authoritative.
Azure Durable FunctionsAzure documents stateful orchestrator/activity/entity functions, managed state, checkpoints, retries, recovery, and Java support.Strong Azure fit, weaker portability if TPF semantics depend on Durable Functions-specific orchestration constraints.
Google Cloud WorkflowsServerless workflow definitions in YAML/JSON, HTTP/service orchestration, retries, callbacks, waits, and monitoring.Good orchestration substrate, but it is workflow-definition-first rather than TPF Java runtime-first. TPF would likely become a compiler to Workflows for that backend.

Decision rule: a provider durable workflow backend is acceptable only if TPF can either:

  1. keep TPF execution/await/release records authoritative and use the provider engine as a wakeup/driver, or
  2. prove a faithful mapping where provider workflow history becomes authoritative without losing TPF observability and re-drive semantics.

The first implementation path should not assume either mapping. Build the TPF-native single-shot action model first; it is useful for provider event sources, cloud functions, and future durable-workflow adapters.

Implementation Slices After This Spike ​

  1. Single-shot coordinator actions — complete. PipelineControlPlane is the action contract, including structured sweepOnce; provider readiness is separate from periodic sweep startup and compute-first behaviour is preserved.
  2. Loop hosting split — complete. The sweeper and SQS pollers are compute-first loop hosts over bounded actions. Aggregate await-continuation retry scheduling remains explicitly deferred.
  3. AWS-shaped local proof — complete. LocalStack DynamoDB/SQS integration invokes the bounded control-plane and message actions directly, including a synthetic scheduled sweepOnce wakeup, restart/event replay, await resume, retry, DLQ, and re-drive. It does not claim Lambda or EventBridge handler support.
  4. Provider function handlers. Add AWS-first function handlers only after the action model is explicit.
  5. Durable workflow adapter spike — complete. The AWS Lambda Durable Execution Java local runner proves an optional, reconstructable driver over the action model, including checkpoint loss, failed and duplicate wake-up, callback-generation fencing, provider-history replacement, Await completion, resume, and result. The subsequent deployed suite injects failure after AWS callback creation, before and after the mechanical registration write, and converges through stream/history/reconciliation repair to a binding and successful completion. That closes the experimental registration-window gate; production adoption still requires the same coverage against the supported host, provider callback/history contract validation, and operator-history integration.

Decision at the proof stage ​

The provider-neutral coordination-host seam is PipelineControlPlane. Native loop hosts invoke it directly; the AWS Durable proof uses a transport adapter for those actions and a separate adapter for provider callback mechanics. Its reconstructable TPF checkpoint excludes provider generation and callback state. The mapping and deployed fault tests demonstrate that a provider durable execution can own substantial mechanical durability while remaining reconstructable from TPF state; provider history, retry/DLQ evidence, and provider re-drive remain non-authoritative.

This proof did not by itself qualify a supported Lambda deployment. The subsequent host packaging and its current release, security, quota and operational requirements are documented in AWS Durable Coordination; outstanding support gates remain in the production completion plan.

Diagram