Replayer
in package
FinalYes
Re-executes a straight-line workflow Fiber against committed, sequence-ordered history.
Table of Contents
Constants
- MAX_VERSION : mixed = 2147483647
- MIN_VERSION : mixed = -2147483648
Properties
Methods
- __construct() : mixed
- replay() : ReplayResult
- appendCompleteCommand() : ReplayResult|null
- appendWorkflowCommand() : ReplayResult|null
- Materialize and JSON-validate a command before adding it to the task completion. Once a local activity has run, a later payload failure must return its durable record instead of discarding it on task redelivery.
- assertCommandMatchesStep() : void
- assertConditionWaitCompatible() : void
- assertDurableHandleExecutionIdentity() : void
- assertNoRemainingSteps() : void
- assertParallelPathMatches() : void
- assertVersionDecisionCompatible() : void
- assertVersionSupported() : void
-
collapseConditionReopens()
: array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list
>, resolution_order: int} > - commandDetail() : string|null
- completeCommand() : array{type: string, result: array{codec: string, blob: string}}
- conditionDetail() : string
- conditionStepKey() : string|null
- decodeMemoHistoryMap() : array<string, mixed>
- Decode the inline Avro map envelope returned by Server history.
- decodeResult() : mixed
- durableHandleResolution() : Throwable}
- hasCompletedHistory() : bool
- historyEventShape() : string|null
- intValue() : int|null
- memoSequence() : int
- parallelEntry() : array<string, mixed>
- parallelPath() : array<int, array<string, mixed>>
- payloadDetail() : string|null
- payloadEncodingFailure() : ReplayResult
-
recordedSteps()
: array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list
>, resolution_order: int} > - resolutionParallelPath() : array<int, array<string, mixed>>
-
resolvedStep()
: Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list
>, resolution_order: int} - result() : ReplayResult
- selectionCancellationForHandle() : array<string, mixed>|null
- selectionCancellations() : array<string|int, mixed>
- selectionOperationIdentities() : array<int, string>
- selectionResolutions() : array<string|int, mixed>
- sequence() : int|null
-
step()
: Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list
>, resolution_order: int} - stringValue() : string|null
- throwSelectionMarkerMismatch() : never
- validatedSelectionResolution() : array<string, mixed>
- validateSelectionCancellationsForHandles() : void
- versionFamily() : string
- versionMarker() : array{string, int}
- versionMarkerInteger() : int
- versionMarkerSequence() : int
Constants
MAX_VERSION
private
mixed
MAX_VERSION
= 2147483647
MIN_VERSION
private
mixed
MIN_VERSION
= -2147483648
Properties
$codec read-only
private
PayloadCodec
$codec
Methods
__construct()
public
__construct(PayloadCodec $codec) : mixed
Parameters
- $codec : PayloadCodec
replay()
public
replay(callable(WorkflowContext, mixed ...$input): mixed $handler, array<int, array<string, mixed>> $history, array<int, mixed> $input, string $taskQueue[, array<string, mixed> $task = [] ][, callable|null $localActivityExecutor = null ]) : ReplayResult
Parameters
- $handler : callable(WorkflowContext, mixed ...$input): mixed
- $history : array<int, array<string, mixed>>
- $input : array<int, mixed>
- $taskQueue : string
- $task : array<string, mixed> = []
- $localActivityExecutor : callable|null = null
Return values
ReplayResultappendCompleteCommand()
private
appendCompleteCommand(array<int, array<string, mixed>> &$commands, mixed $result, WorkflowContext|null $context) : ReplayResult|null
Parameters
- $commands : array<int, array<string, mixed>>
- $result : mixed
- $context : WorkflowContext|null
Return values
ReplayResult|nullappendWorkflowCommand()
Materialize and JSON-validate a command before adding it to the task completion. Once a local activity has run, a later payload failure must return its durable record instead of discarding it on task redelivery.
private
appendWorkflowCommand(array<int, array<string, mixed>> &$commands, WorkflowCommand $command, string $taskQueue, WorkflowContext|null $context) : ReplayResult|null
Parameters
- $commands : array<int, array<string, mixed>>
- $command : WorkflowCommand
- $taskQueue : string
- $context : WorkflowContext|null
Return values
ReplayResult|nullassertCommandMatchesStep()
private
assertCommandMatchesStep(WorkflowCommand $command, array<string, mixed> $step) : void
Parameters
- $command : WorkflowCommand
- $step : array<string, mixed>
assertConditionWaitCompatible()
private
assertConditionWaitCompatible(Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int} $step, WorkflowCommand $command) : void
Parameters
- $step : Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int}
- $command : WorkflowCommand
assertDurableHandleExecutionIdentity()
private
assertDurableHandleExecutionIdentity(DurableOperationHandle $handle, WorkflowContext|null $context) : void
Parameters
- $handle : DurableOperationHandle
- $context : WorkflowContext|null
assertNoRemainingSteps()
private
assertNoRemainingSteps(array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list>, resolution_order: int} > $steps, int $stepCursor, string $terminalCommand) : void
Parameters
-
$steps
: array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list
>, resolution_order: int} > - $stepCursor : int
- $terminalCommand : string
assertParallelPathMatches()
private
assertParallelPathMatches(array<string, mixed> $step, array<int, array<string, mixed>> $expectedPath) : void
Parameters
- $step : array<string, mixed>
- $expectedPath : array<int, array<string, mixed>>
assertVersionDecisionCompatible()
private
assertVersionDecisionCompatible(string $changeId, array{version: int, family: string, sequence: ?int} $decision, WorkflowCommand $command) : void
Parameters
- $changeId : string
- $decision : array{version: int, family: string, sequence: ?int}
- $command : WorkflowCommand
assertVersionSupported()
private
assertVersionSupported(string $changeId, int $version, int $minSupported, int $maxSupported, int|null $sequence) : void
Parameters
- $changeId : string
- $version : int
- $minSupported : int
- $maxSupported : int
- $sequence : int|null
collapseConditionReopens()
private
collapseConditionReopens(array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list>, resolution_order: int} > $steps) : array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list>, resolution_order: int} >
Parameters
-
$steps
: array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list
>, resolution_order: int} >
Return values
array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: listcommandDetail()
private
commandDetail(WorkflowCommand $command) : string|null
Parameters
- $command : WorkflowCommand
Return values
string|nullcompleteCommand()
private
completeCommand(mixed $result) : array{type: string, result: array{codec: string, blob: string}}
Parameters
- $result : mixed
Return values
array{type: string, result: array{codec: string, blob: string}}conditionDetail()
private
conditionDetail(string|null $conditionKey, string|null $definitionFingerprint) : string
Parameters
- $conditionKey : string|null
- $definitionFingerprint : string|null
Return values
stringconditionStepKey()
private
conditionStepKey(array<string, mixed> $payload, array<string, string> $conditionStepsByWaitId) : string|null
Parameters
- $payload : array<string, mixed>
- $conditionStepsByWaitId : array<string, string>
Return values
string|nulldecodeMemoHistoryMap()
Decode the inline Avro map envelope returned by Server history.
private
decodeMemoHistoryMap(mixed $envelope, int $sequence, string $field, bool $requireEntries) : array<string, mixed>
External memo command references are resolved by the runtime before the MemoUpserted event is recorded, so replay always consumes inline bytes.
Parameters
- $envelope : mixed
- $sequence : int
- $field : string
- $requireEntries : bool
Return values
array<string, mixed>decodeResult()
private
decodeResult(array<string, mixed> $payload) : mixed
Parameters
- $payload : array<string, mixed>
durableHandleResolution()
private
durableHandleResolution(DurableOperationHandle $handle, array<int, array<string, mixed>> $stepsBySequence, array<string, array<string, mixed>> $selectionCancellations) : Throwable}
Parameters
- $handle : DurableOperationHandle
- $stepsBySequence : array<int, array<string, mixed>>
- $selectionCancellations : array<string, array<string, mixed>>
Return values
Throwable}hasCompletedHistory()
private
hasCompletedHistory(array<int, array<string, mixed>> $history) : bool
Parameters
- $history : array<int, array<string, mixed>>
Return values
boolhistoryEventShape()
private
historyEventShape(string $type, array<string, mixed> $payload) : string|null
Parameters
- $type : string
- $payload : array<string, mixed>
Return values
string|nullintValue()
private
intValue(mixed $value) : int|null
Parameters
- $value : mixed
Return values
int|nullmemoSequence()
private
memoSequence(array<string, mixed> $payload) : int
Parameters
- $payload : array<string, mixed>
Return values
intparallelEntry()
private
parallelEntry(array<string, mixed> $payload, int $sequence) : array<string, mixed>
Parameters
- $payload : array<string, mixed>
- $sequence : int
Return values
array<string, mixed>parallelPath()
private
parallelPath(array<string, mixed> $payload, int $sequence) : array<int, array<string, mixed>>
Parameters
- $payload : array<string, mixed>
- $sequence : int
Return values
array<int, array<string, mixed>>payloadDetail()
private
payloadDetail(array<string, mixed> $payload, string $shape) : string|null
Parameters
- $payload : array<string, mixed>
- $shape : string
Return values
string|nullpayloadEncodingFailure()
private
payloadEncodingFailure(array<int, array<string, mixed>> $commands, WorkflowContext|null $context, Throwable $failure) : ReplayResult
Parameters
- $commands : array<int, array<string, mixed>>
- $context : WorkflowContext|null
- $failure : Throwable
Return values
ReplayResultrecordedSteps()
private
recordedSteps(array<int, array<string, mixed>> $history) : array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list>, resolution_order: int} >
Parameters
- $history : array<int, array<string, mixed>>
Return values
array<int, Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: listresolutionParallelPath()
private
resolutionParallelPath(array<string, mixed> $payload, array<string, mixed>|null $previous, int $sequence) : array<int, array<string, mixed>>
Parameters
- $payload : array<string, mixed>
- $previous : array<string, mixed>|null
- $sequence : int
Return values
array<int, array<string, mixed>>resolvedStep()
private
resolvedStep(int $sequence, string $shape, mixed $value[, Throwable|null $failure = null ][, string|null $detail = null ][, string|null $conditionKey = null ][, string|null $conditionDefinitionFingerprint = null ][, int|null $timeoutSeconds = null ][, array<int, array<string, mixed>> $parallelPath = [] ][, int $resolutionOrder = PHP_INT_MAX ]) : Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list>, resolution_order: int}
Parameters
- $sequence : int
- $shape : string
- $value : mixed
- $failure : Throwable|null = null
- $detail : string|null = null
- $conditionKey : string|null = null
- $conditionDefinitionFingerprint : string|null = null
- $timeoutSeconds : int|null = null
- $parallelPath : array<int, array<string, mixed>> = []
- $resolutionOrder : int = PHP_INT_MAX
Return values
Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: listresult()
private
result(array<int, array<string, mixed>> $commands, WorkflowContext|null $context[, Throwable|null $terminalFailure = null ][, int|null $failedActivitySequence = null ][, string|null $failedActivityExecutionId = null ]) : ReplayResult
Parameters
- $commands : array<int, array<string, mixed>>
- $context : WorkflowContext|null
- $terminalFailure : Throwable|null = null
- $failedActivitySequence : int|null = null
- $failedActivityExecutionId : string|null = null
Return values
ReplayResultselectionCancellationForHandle()
private
selectionCancellationForHandle(DurableOperationHandle $handle, array<string, array<string, mixed>> $selectionCancellations) : array<string, mixed>|null
Parameters
- $handle : DurableOperationHandle
- $selectionCancellations : array<string, array<string, mixed>>
Return values
array<string, mixed>|nullselectionCancellations()
private
selectionCancellations(array<int, array<string, mixed>> $history) : array<string|int, mixed>
Parameters
- $history : array<int, array<string, mixed>>
-
@return array<string, array<string, mixed>>
Return values
array<string|int, mixed>selectionOperationIdentities()
private
selectionOperationIdentities(array<int, array<string, mixed>> $history) : array<int, string>
Parameters
- $history : array<int, array<string, mixed>>
Return values
array<int, string>selectionResolutions()
private
selectionResolutions(array<int, array<string, mixed>> $history) : array<string|int, mixed>
Parameters
- $history : array<int, array<string, mixed>>
-
@return array<string, array<string, mixed>>
Return values
array<string|int, mixed>sequence()
private
sequence(array<string, mixed> $payload) : int|null
Parameters
- $payload : array<string, mixed>
Return values
int|nullstep()
private
step(int $sequence, string $shape[, string|null $detail = null ][, string|null $conditionKey = null ][, string|null $conditionDefinitionFingerprint = null ][, int|null $timeoutSeconds = null ][, array<int, array<string, mixed>> $parallelPath = [] ][, int $resolutionOrder = PHP_INT_MAX ]) : Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: list>, resolution_order: int}
Parameters
- $sequence : int
- $shape : string
- $detail : string|null = null
- $conditionKey : string|null = null
- $conditionDefinitionFingerprint : string|null = null
- $timeoutSeconds : int|null = null
- $parallelPath : array<int, array<string, mixed>> = []
- $resolutionOrder : int = PHP_INT_MAX
Return values
Throwable, condition_key: ?string, condition_definition_fingerprint: ?string, timeout_seconds: ?int, parallel_path: liststringValue()
private
stringValue(mixed $value) : string|null
Parameters
- $value : mixed
Return values
string|nullthrowSelectionMarkerMismatch()
private
throwSelectionMarkerMismatch(int $sequence, array<string, mixed> $marker, string $detail[, string $reason = 'selection_resolution_member_mismatch' ]) : never
Parameters
- $sequence : int
- $marker : array<string, mixed>
- $detail : string
- $reason : string = 'selection_resolution_member_mismatch'
Return values
nevervalidatedSelectionResolution()
private
validatedSelectionResolution(ParallelWorkflowCommand $group, int $baseSequence, array<string, mixed> $marker, array<int, array<string, mixed>> $stepsBySequence, array<int, array<string, mixed>> $history, array<int, string> $operationIdentities) : array<string, mixed>
Parameters
- $group : ParallelWorkflowCommand
- $baseSequence : int
- $marker : array<string, mixed>
- $stepsBySequence : array<int, array<string, mixed>>
- $history : array<int, array<string, mixed>>
- $operationIdentities : array<int, string>
Return values
array<string, mixed>validateSelectionCancellationsForHandles()
private
validateSelectionCancellationsForHandles(array<int|string, DurableOperationHandle> $handles, array<string, array<string, mixed>> $selectionCancellations) : void
Parameters
- $handles : array<int|string, DurableOperationHandle>
- $selectionCancellations : array<string, array<string, mixed>>
versionFamily()
private
versionFamily(WorkflowCommand $command) : string
Parameters
- $command : WorkflowCommand
Return values
stringversionMarker()
private
versionMarker(array<string, mixed> $payload, int $sequence) : array{string, int}
Parameters
- $payload : array<string, mixed>
- $sequence : int
Return values
array{string, int}versionMarkerInteger()
private
versionMarkerInteger(array<string, mixed> $payload, string $field, int $sequence) : int
Parameters
- $payload : array<string, mixed>
- $field : string
- $sequence : int
Return values
intversionMarkerSequence()
private
versionMarkerSequence(array<string, mixed> $payload) : int
Parameters
- $payload : array<string, mixed>