Skip to content

Home > intention-kernel > Durability > withTurn

Durability.withTurn() method ​

Serialize work for one thread and deduplicate the supplied turn identity.

Signature:

typescript
withTurn<T>(identity: {
        readonly threadId: ThreadId;
        readonly turnId: TurnId;
    }, operation: (scope: DurableTurnScope) => Promise<T>): Promise<T>;

Parameters ​

Parameter

Type

Description

identity

{ readonly threadId: ThreadId; readonly turnId: TurnId; }

operation

(scope: DurableTurnScope) => Promise<T>

Returns:

Promise<T>

Remarks ​

Production adapters must hold an exclusive thread lease for the complete callback and guarantee atomic commit of result, checkpoint and outbox.