Skip to content

Await Unit Sequences ​

These diagrams show how the await unit model parks and resumes QUEUE_ASYNC executions.

Unary Deferred Completion ​

Suspension is normal control flow. It should not be logged as a failed step or routed through recovery as an exception.

One-To-One Over Stream ​

An operation emitting a Multi creates a stream of unary completions inside one owning unit. This is the model used by csv-payments: each PaymentRecord operation result is one request and each provider completion is one final output. For a paged source, that unit belongs to the current page transition. Its page identity scopes item positions, correlations, and idempotency keys so the same page can replay safely without colliding with another page.

For brokered completion transports, the preferred queue-async path is live. AwaitCompletionSupport opens a live await session for the unit, source dispatch is bounded by the configured in-flight window, and each completion is recorded before it is emitted to the resumed suffix. If that live session is unavailable, the coordinator falls back to durable item continuations.

Completion may arrive out of order. The live path can process accepted completions as they arrive; durable fallback preserves item identity by reading completed item interactions by itemIndex.

Await Unit Gatekeeper ​

The await unit is the durable shape for completion. In the live path, it is the identity, ordering, and dedupe anchor for item interactions. In the fallback path, it also gates release so completions cannot race ahead of durable parent suspension.

For an operation-result stream, the unit groups item interactions for ordering, dedupe, live-session identity, and fallback release. It is not provider-side batching. Whole-batch semantics use an explicit bounded canonical collection as one operation result.

CSV Payments Itemized Await ​

This is the concrete connector-first csv-payments shape. The user submits one CSV object. Process Csv Payments Input opens one bounded page and emits parser-valid logical records through a Kafka completion overlay. The approved and unapproved status branches can run per completed item through the live await session, Finalize Payment Output joins the terminal branches, and Object Publish stages page parts. A fenced page commit starts the next page; only an exhausted page permits ordered composition and logical execution success.

The model is itemized until the next aggregate or terminal boundary. For an unpaged source, an authored downstream MANY_TO_ONE or MANY_TO_MANY step can resume from the collected ordered item outputs. The first paging contract rejects cross-page aggregates, so a paged suffix must remain streaming through its terminal consumer. Object Publish groups values within the live stream, commits bounded page-part manifests, and composes those parts only after source exhaustion.

Persisting the page completion with WAITING_EXTERNAL lets a resumed suffix finish the same page transition. The fallback aggregate gates reconstruction after owner loss; it does not gate an item that an active live session has already admitted.

Durable Item Continuation Recovery ​

The durable fallback has two separate progress boundaries for every item: provider completion and child continuation completion. A provider response is not aggregate progress by itself. TPF first persists the admitted response, then records the child continuation result, then records the idempotent continuation-completion fact for that item. The parent is eligible for release only when every required continuation fact and every required child execution are durably successful.

Concurrent Child Mutation ​

An item child is a durable materialization record. A queue worker can claim it between creation and the continuation flow's first compare-and-swap write. That changes the child version but does not mean the item failed. The continuation flow reloads the child from durable state and retries the success write using the refreshed version when the child is still QUEUED or RUNNING.

The retry is deliberately limited to pending child materialization. A child that is already SUCCEEDED is idempotent. A failed, cancelled, or otherwise terminal child is not overwritten; the continuation remains a real failure. This keeps a version race from becoming a parent-fatal error without allowing a stale worker to rewrite a semantic terminal outcome.

Restart And Reassignment ​

No worker-local claim or completion observation proves aggregate readiness. A fresh runtime uses the await unit and durable child executions to reconstruct progress. If a prior process made a child successful but stopped before writing its continuation fact, the next completion reconciles that missing fact from the child record. The reconciliation claim merely coalesces duplicate scans; it is never correctness state.

Edge-Case Rules ​

SituationDurable ruleResult
duplicate provider completioninteraction completion is idempotentno additional semantic continuation progress
conflicting completionthe admitted interaction contract remains authoritativereject the conflicting completion
provider completion before parent suspensioncompletion persists, but dispatch waits for dispatchComplete and parent WAITING_EXTERNALno premature continuation
final provider completion with a missing child factread ordered durable children and repair only facts backed by SUCCEEDED childrenparent remains held until every required child is successful
concurrent child version mutationreload durable child and retry only QUEUED or RUNNING materializationrecoverable CAS race does not fail the parent
duplicate parent releaseparent compare-and-swap is the semantic admission pointone accepted parent advance; duplicate physical attempts are harmless
restart after child completion or parent releasereconstruct from the await unit, interactions, child executions, and parent recordno worker-local state is needed
terminal parent pathrelease capacity, claims, interactions, continuation facts, and child workno orphaned pending state

Terminal Materialization Boundary ​

An itemized suffix can leave the final business step with a materialized terminal value. Queue async represents the required terminal commit as a synthetic cursor whose currentStepIndex equals the generated pipeline step count. That cursor is a coordinator boundary, not another business step: it must publish and commit the already materialized canonical value without encoding it for a remote transition-worker invocation.

This distinction matters under burst load. Sending a 1,000-item terminal result through a no-op worker call adds a large, competing transport operation after all business work is done. It can delay publication even though the durable execution is otherwise ready to finish. The coordinator instead retains the materialized value, performs the normal terminal publication, and commits success.

The ordinary worker path still applies while currentStepIndex names a generated business step. Only a non-suspended MATERIALIZED_MULTI terminal cursor is coordinator-owned; it is not a shortcut around business execution, completion admission, persistence, or terminal publication. A terminal cursor that resumes from deferred completion still loads the canonical completion payload and enters the normal worker path before publication.

Timeout And Resume ​

Completion admission follows the opposite path: complete the interaction, update the unit, and resume the execution only when the unit is complete.

Diagram