Durable Workflow PHP SDK — API Reference

Guides

Worker
in package

FinalYes

Managed synchronous remote worker for workflow, activity, query, and update tasks.

Table of Contents

Constants

DEFAULT_HEARTBEAT_INTERVAL_SECONDS  : mixed = 30
INITIAL_TRANSIENT_RETRY_DELAY_SECONDS  : mixed = 0.1
MAX_HEARTBEAT_INTERVAL_SECONDS  : mixed = 3600
MAX_LOCAL_ACTIVITY_EXCEPTION_TYPE_BYTES  : mixed = 255
MAX_LOCAL_ACTIVITY_HEARTBEATS  : mixed = 1000
MAX_LOCAL_ACTIVITY_HEARTBEATS_PER_ATTEMPT  : mixed = 1000
MAX_STALE_REGISTRATION_BACKOFF_SECONDS  : mixed = 60.0
MAX_TRANSIENT_RETRY_DELAY_SECONDS  : mixed = 5.0
REREGISTRATION_METRIC  : mixed = 'durable_workflow_worker_reregistrations'
TRANSIENT_RETRY_SLEEP_SLICE_SECONDS  : mixed = 0.1
WORKFLOW_HISTORY_PAGE_SIZE  : mixed = 500

Properties

$taskQueue  : string
$activeWorkerSessions  : array<string, WorkerSessionOptions>
$activities  : array<string|int, HandlerDefinition>
$activityCompletionWorkflowPollSupported  : bool
$activityContinuation  : array<string, mixed>|null
$activityLeaseHelper  : ActivityLeaseProcess|null
$activityLeaseProcess  : ActivityLeaseProcess|null
$activityLeaseRenewalSupported  : bool
$activityPollStartedAt  : float|null
$activityTasksInFlight  : int
$buildId  : string|null
$carriedActivityPoll  : CarriedPoll|null
$carriedWorkflowPoll  : CarriedPoll|null
$childStartTurnSupported  : bool
$claimCancellation  : CancellationRequest|null
$claimDeliveredCancellationId  : string|null
$client  : Client
$clock  : callable(): float
$completionPipeline  : CompletionPipeline|null
$deliveredWorkflowHistoryObserver  : callable(string, string, int, array<int, array<string, mixed>>): void|null
$diagnosticListener  : callable(string, array<string, mixed>): void|null
$drainingCarriedLease  : bool
$enableActivityContinuation  : bool
Opt-in (Server #1078). After an activity succeeds, replay its run with the result and send the next workflow commands with the completion. Used only when the server advertises activity_workflow_continuation; anything unsupported falls back to the ordinary path.
$enableCancellationScopes  : bool
Unfrozen source opt-in for scalar/all-group scope delivery and committed scope replay.
$enableCompletionPipelining  : bool
Opt-in. Changes when completion failures become visible; never applies to public tick().
$enableCooperativeCancellation  : bool
Source opt-in. Activity callbacks run in a Unix child process. Open handler-owned connections there. Captured memory changes do not update the owning worker.
$enablePreparedLocalActivities  : bool
Source opt-in for durably admitted sequential local callbacks.
$groupedConditionWaitsAdvertised  : bool
$handlerDiscovery  : HandlerDiscovery
$heartbeatIntervalSeconds  : int
$heartbeatRetryAt  : float
$heartbeatRetryAttempt  : int
$lastHeartbeatAt  : float
$lastStaleRegistrationRecoveryAt  : float
$logger  : LoggerInterface
$metricsObserver  : MetricsObserver
$nativeServerVersion  : string|false|null
Lazily discovered: false = not native, string = native Server description (sdk-php#278).
$pipelineManagedTick  : bool
$pollSweepRequested  : bool
$preparedLocalActivityCancellationPolicies  : array<int, string>
$preparedLocalActivityGroupsSupported  : bool
$queries  : array<string|int, array<string|int, HandlerDefinition>>
$queryTaskAuthority  : QueryTaskAuthority|null
$queryTaskAuthoritySupported  : bool
$registered  : bool
$registrationToken  : string|null
$replayer  : Replayer
$requireQueryTaskAuthority  : bool
$serviceOperationsSupported  : bool
$shutdownByRequest  : bool
Set only by requestShutdown() and process signals, so stale-registration recovery never overrides them.
$shutdownRequested  : bool
$signals  : array<string|int, array<string|int, callable(mixed ...$arguments): mixed>>
$sleeper  : callable(int): void
$staleRegistrationObserved  : bool
$staleRegistrationRecoveries  : int
$stickyCache  : StickyWorkflowCache
$stickyHistorySuffixSupported  : bool
$stopOnStaleRegistration  : bool
When the Server answers 409 stale_worker_registration, run() drops the fenced claims and re-registers as a new incarnation. Set true to keep the pre-3.13 behavior and stop instead.
$taskObservation  : WorkerTaskObservation|null
$telemetry  : ExecutionTelemetry|null
$transientPollRetryObserver  : callable(string, int, float, ServerException): void|null
$unbindActivityLease  : callable(): void|null
$updates  : array<string|int, array<string|int, HandlerDefinition>>
$workerId  : string
$workflowCompletionActivityPollSupported  : bool
$workflowCompletionWorkflowPollSupported  : bool
$workflowExecutedLocalActivity  : bool
$workflowMemoCapability  : array<string, mixed>|null
$workflowPollGrant  : WorkflowPollGrant|null
$workflowPollStartedAt  : float|null
$workflows  : array<string|int, HandlerDefinition>
$workflowTasksInFlight  : int

Methods

__construct()  : mixed
contracts()  : array{workflows: list, activities: list, workflow_commands: array}
Return the complete local definition sent during worker registration.
create()  : self
Construct the preferred class-oriented worker surface.
declareSignal()  : self
Declare a replay-consumed signal and its argument signature.
register()  : self
Discover and register one or more attribute-based handler services.
registerActivity()  : self
registerQuery()  : self
registerUpdate()  : self
registerWorkflow()  : self
requestShutdown()  : void
Request that run() stop polling and perform its managed cleanup on exit.
run()  : void
Register, initialize heartbeat state, poll, and deregister on exit.
stickyCacheMetrics()  : array{hit: int, miss: int, eviction: int, forced_cold_replay: int}
tick()  : bool
Execute at most one task of each kind during an ordinary tick.
validate()  : void
Validate every registered command contract without contacting the server.
workerSession()  : WorkerSession
Create an explicit typed worker-session lifecycle handle.
acknowledgeStoppedRemoteActivity()  : void
This is reached only after the isolated callback stopped and its relay joined.
acknowledgeTaskFailure()  : void
advertisesGroupedConditionWaits()  : bool
applyHeartbeatInterval()  : void
assertCancellationDeadline()  : void
assertCancellationPoliciesAvailable()  : void
assertChildStartTurnAvailable()  : void
A runtime without the capability ignores the unknown await field and would start the child without the parent turn startChildWorkflow() waits for, so the claim is abandoned before anything is submitted.
assertDiscoveriesCanRegister()  : void
assertHandlerContext()  : void
assertLocalWorkflowClaimActive()  : void
assertPayloadCancellation()  : void
assertPayloadDeadline()  : void
assertPipelineAuthority()  : void
assertRemoteActivityClaimActive()  : void
assertServiceOperationsAvailable()  : void
assertSignalNameIsNotRuntimeReserved()  : void
assertSupportedTaskPayloadCodec()  : void
assertUnique()  : void
assertValidDeclarationName()  : void
assertWorkflowMemoUpdatesAvailable()  : void
authoritativeWorkflowTaskHistory()  : array<int, array<string, mixed>>
Fetch complete durable history after a sticky cache miss.
capturePipelineState()  : array<string, mixed>
captureRegistrationFence()  : void
checkpointPreparedLocalPrefix()  : array<int, array<string, mixed>>
claimCancellationObservation()  : array<string, string>
closeWorkerSessions()  : void
commandHandlerContracts()  : array<int, array{name: string, parameters: list}>
completeHistory()  : array<int, array<string, mixed>>
completionPipeliningAvailable()  : bool
confirmWorkflowPollGrant()  : bool
crossKindPollWakeReceived()  : bool
declarationNames()  : array<int, string>
Restore string declaration names after PHP coerces numeric dictionary keys.
decodeArguments()  : array<int, mixed>
deliverCancellationOrDeferClaim()  : void
deregisterWithRetry()  : void
diagnoseWorkflowWait()  : void
diagnostic()  : void
discardClosedActivityAttempt()  : bool
discoverGroupedConditionWaitSupport()  : void
Native Server refuses condition waits inside all()/parallel() until it advertises grouped_condition_waits (server#1142). The replayer asks this only when it is about to send such a wait, so ordinary workers never make the extra cluster-info request.
dispatchPolledTask()  : void
drainCarriedWorkflowLease()  : bool
effectiveBuildId()  : string
elapsedSinceHeartbeat()  : float
establishRegistration()  : void
executeActivityTask()  : void
executeLocalActivity()  : array<string, mixed>
executePolledTask()  : void
executePreparedLocalActivity()  : array<int, array<string, mixed>>
executePreparedLocalActivityGroup()  : array<int, array<string, mixed>>
executeQueryTask()  : void
executeTask()  : void
executeUpdate()  : array<string, mixed>
executeWorkflowTask()  : void
groupedConditionWaitRefusal()  : string|null
haltPolling()  : void
handlerFailure()  : void
heartbeat()  : void
heartbeatIfDue()  : void
historyFromTask()  : array<int, array<string, mixed>>
incarnationLabel()  : string|null
A short fingerprint names the incarnation in logs without exposing its deregistration token.
installPipelineState()  : void
installSignalHandlers()  : void
invokeActivity()  : mixed
isCommittedActivityCompletion()  : bool
isPollCapacityRefusal()  : bool
isRunClosedActivityRefusal()  : bool
The run closed (complete, fail or continue-as-new) after this activity was claimed, so its outcome or failure report is refused with run_closed and nothing is recorded on the closed run (Workflow #1117, Server #1193).
isTaskAuthorityLost()  : bool
isTimedOutWorkflowCompletion()  : bool
isTransientDatabaseFailure()  : bool
isTransientDeregistrationFailure()  : bool
isTransientRegistrationFailure()  : bool
isTransientWorkflowTaskLeaseRefusal()  : bool
localActivityAttemptId()  : string
matchesWorkflowTaskLeaseFence()  : bool
notifyDeliveredWorkflowHistory()  : void
Hand the qualification observer a copy of one attempt's replay input or completion commands. Inert without an observer; observer failures never change the task's outcome.
now()  : float
observeCarriedWorkflowCompletion()  : void
observeClaimCancellation()  : CancellationRequest
observePoll()  : array<string, mixed>
observeTaskReadyAge()  : void
performTick()  : bool
pipelineTick()  : bool
pollFailurePolicy()  : array{retry: bool, retain: bool}
pollWithRetry()  : array<string, mixed>|null
pollWorkflowForTick()  : array<string, mixed>|null
prepareActivityLeaseMaintenance()  : void
prepareCompletionPipeline()  : void
prepareLocalCallback()  : Closure}
preparePoll()  : int
queryAuthorityForTask()  : QueryTaskAuthority|null
queryRequestBudget()  : RequestBudget|null
recoversFromStaleRegistration()  : bool
Only run() recovers, only from the Server's own stale-registration answer, and never past a requested shutdown.
recoverStaleRegistration()  : bool
The Server has fenced this incarnation. Every claim it held is dropped without completing, failing or heartbeating it, because lease expiry redelivers that work. The worker then registers again, which rotates the incarnation token. Consecutive recoveries back off with jitter so this can never loop tightly.
refreshCancellationHistory()  : array<string|int, mixed>
refreshPreparedLocalHistory()  : array<int, array<string, mixed>>
refreshWorkflowClaimHistory()  : array<int, array<string, mixed>>
registerActivityDefinition()  : self
registerQueryDefinition()  : self
registerUpdateDefinition()  : self
registerWithRetry()  : array<string, mixed>|null
registerWorkflowDefinition()  : self
rejectPolledTask()  : void
rememberCarriedPollCapabilities()  : void
rememberWorkflowMemoCapability()  : void
rememberWorkflowPollCapabilities()  : void
renewWorkflowTaskLease()  : bool
replayWorkflowClaim()  : ReplayResult
reserveActivityPoll()  : CarriedPoll|null
reserveWorkflowPoll()  : CarriedPoll|null
resetPipelineState()  : void
resumePipelineFiber()  : void
retryStoppedRemoteActivityReceiptRequest()  : array<string, mixed>
retryStorageAdmission()  : T
settleRunClosedActivityRefusal()  : bool
An abandon-policy activity its run left running at close still closes with its own outcome; the Server answers run_closed because nothing is appended to the closed run. That is success for this Worker. Any other run_closed refusal means the close cancelled the activity.
speculateActivityContinuation()  : array{version: int, history_through_sequence: int, history_last_event_id: string, commands: list>}|null
Server #1078: replay the activity's run with its own result appended and return the next workflow commands, or null for the ordinary completion. The replay has no local executor, preparation, checkpoint or scope delivery, so it makes no request. It is abandoned when the workflow reads business time the server has not assigned yet, or produces anything outside the advertised v1 command set. The server still decides; a decline is always safe.
staleRegistrationPoll()  : bool
stickyCacheClaim()  : array{worker_id: string, workflow_id: string, run_id: string, build_id: string, ttl_seconds: int, metrics: array{hit: int, miss: int, eviction: int, forced_cold_replay: int}}|null
stopActivityLease()  : void
stopForTerminalPoll()  : bool
taskFromPoll()  : array<string, mixed>|null
trackWorkerSessionFromTask()  : void
transientRetryDelay()  : float
validHeartbeatInterval()  : int|null
waitForPollRetry()  : void
waitForTransientRetry()  : void
workerPayloadProgress()  : callable(): void|null
workflowCommandContracts()  : array<string|int, array{queries: list, query_contracts: list}>, signals: list, signal_contracts: list}>, updates: list, update_validators: list, update_contracts: list}>}>
workflowDefinitionFingerprints()  : array<string|int, string>
workflowFailureCommand()  : array<string, mixed>
workflowTaskLeaseResponseFailure()  : ServerException

Constants

DEFAULT_HEARTBEAT_INTERVAL_SECONDS

private mixed DEFAULT_HEARTBEAT_INTERVAL_SECONDS = 30

INITIAL_TRANSIENT_RETRY_DELAY_SECONDS

private mixed INITIAL_TRANSIENT_RETRY_DELAY_SECONDS = 0.1

MAX_HEARTBEAT_INTERVAL_SECONDS

private mixed MAX_HEARTBEAT_INTERVAL_SECONDS = 3600

MAX_LOCAL_ACTIVITY_EXCEPTION_TYPE_BYTES

private mixed MAX_LOCAL_ACTIVITY_EXCEPTION_TYPE_BYTES = 255

MAX_LOCAL_ACTIVITY_HEARTBEATS

private mixed MAX_LOCAL_ACTIVITY_HEARTBEATS = 1000

MAX_LOCAL_ACTIVITY_HEARTBEATS_PER_ATTEMPT

private mixed MAX_LOCAL_ACTIVITY_HEARTBEATS_PER_ATTEMPT = 1000

MAX_STALE_REGISTRATION_BACKOFF_SECONDS

private mixed MAX_STALE_REGISTRATION_BACKOFF_SECONDS = 60.0

MAX_TRANSIENT_RETRY_DELAY_SECONDS

private mixed MAX_TRANSIENT_RETRY_DELAY_SECONDS = 5.0

REREGISTRATION_METRIC

private mixed REREGISTRATION_METRIC = 'durable_workflow_worker_reregistrations'

TRANSIENT_RETRY_SLEEP_SLICE_SECONDS

private mixed TRANSIENT_RETRY_SLEEP_SLICE_SECONDS = 0.1

WORKFLOW_HISTORY_PAGE_SIZE

private mixed WORKFLOW_HISTORY_PAGE_SIZE = 500

Properties

$taskQueue read-only

public string $taskQueue

$activities

private array<string|int, HandlerDefinition> $activities = []

$activityCompletionWorkflowPollSupported

private bool $activityCompletionWorkflowPollSupported = false

$activityContinuation

private array<string, mixed>|null $activityContinuation = null

The server's advertised activity_workflow_continuation v1 contract.

$activityLeaseHelper

private ActivityLeaseProcess|null $activityLeaseHelper = null

$activityLeaseProcess

private ActivityLeaseProcess|null $activityLeaseProcess = null

$activityLeaseRenewalSupported

private bool $activityLeaseRenewalSupported = false

$activityPollStartedAt

private float|null $activityPollStartedAt = null

$activityTasksInFlight

private int $activityTasksInFlight = 0

$buildId read-only

private string|null $buildId = null

$carriedActivityPoll

private CarriedPoll|null $carriedActivityPoll = null

$carriedWorkflowPoll

private CarriedPoll|null $carriedWorkflowPoll = null

$childStartTurnSupported

private bool $childStartTurnSupported = false

$claimDeliveredCancellationId

private string|null $claimDeliveredCancellationId = null

$clock read-only

private callable(): float $clock

$completionPipeline

private CompletionPipeline|null $completionPipeline = null

$deliveredWorkflowHistoryObserver

private callable(string, string, int, array<int, array<string, mixed>>): void|null $deliveredWorkflowHistoryObserver = null

$diagnosticListener read-only

private callable(string, array<string, mixed>): void|null $diagnosticListener

$drainingCarriedLease

private bool $drainingCarriedLease = false

$enableActivityContinuation read-only

Opt-in (Server #1078). After an activity succeeds, replay its run with the result and send the next workflow commands with the completion. Used only when the server advertises activity_workflow_continuation; anything unsupported falls back to the ordinary path.

private bool $enableActivityContinuation = false

$enableCancellationScopes read-only

Unfrozen source opt-in for scalar/all-group scope delivery and committed scope replay.

private bool $enableCancellationScopes = false

$enableCompletionPipelining read-only

Opt-in. Changes when completion failures become visible; never applies to public tick().

private bool $enableCompletionPipelining = false

$enableCooperativeCancellation read-only

Source opt-in. Activity callbacks run in a Unix child process. Open handler-owned connections there. Captured memory changes do not update the owning worker.

private bool $enableCooperativeCancellation = false

$enablePreparedLocalActivities read-only

Source opt-in for durably admitted sequential local callbacks.

private bool $enablePreparedLocalActivities = false

$groupedConditionWaitsAdvertised

private bool $groupedConditionWaitsAdvertised = false

$handlerDiscovery read-only

private HandlerDiscovery $handlerDiscovery

$heartbeatIntervalSeconds

private int $heartbeatIntervalSeconds

$heartbeatRetryAt

private float $heartbeatRetryAt = 0.0

$heartbeatRetryAttempt

private int $heartbeatRetryAttempt = 0

$lastHeartbeatAt

private float $lastHeartbeatAt = 0.0

$lastStaleRegistrationRecoveryAt

private float $lastStaleRegistrationRecoveryAt = 0.0

$logger read-only

private LoggerInterface $logger

$metricsObserver read-only

private MetricsObserver $metricsObserver

$nativeServerVersion

Lazily discovered: false = not native, string = native Server description (sdk-php#278).

private string|false|null $nativeServerVersion = null

$pipelineManagedTick

private bool $pipelineManagedTick = false

$pollSweepRequested

private bool $pollSweepRequested = false

$preparedLocalActivityCancellationPolicies

private array<int, string> $preparedLocalActivityCancellationPolicies = []

$preparedLocalActivityGroupsSupported

private bool $preparedLocalActivityGroupsSupported = false

$queries

private array<string|int, array<string|int, HandlerDefinition>> $queries = []

$queryTaskAuthority

private QueryTaskAuthority|null $queryTaskAuthority = null

$queryTaskAuthoritySupported

private bool $queryTaskAuthoritySupported = false

$registered

private bool $registered = false

$registrationToken

private string|null $registrationToken = null

$requireQueryTaskAuthority read-only

private bool $requireQueryTaskAuthority = false

$serviceOperationsSupported

private bool $serviceOperationsSupported = false

$shutdownByRequest

Set only by requestShutdown() and process signals, so stale-registration recovery never overrides them.

private bool $shutdownByRequest = false

$shutdownRequested

private bool $shutdownRequested = false

$signals

private array<string|int, array<string|int, callable(mixed ...$arguments): mixed>> $signals = []

$sleeper read-only

private callable(int): void $sleeper

$staleRegistrationObserved

private bool $staleRegistrationObserved = false

$staleRegistrationRecoveries

private int $staleRegistrationRecoveries = 0

$stickyHistorySuffixSupported

private bool $stickyHistorySuffixSupported = false

$stopOnStaleRegistration read-only

When the Server answers 409 stale_worker_registration, run() drops the fenced claims and re-registers as a new incarnation. Set true to keep the pre-3.13 behavior and stop instead.

private bool $stopOnStaleRegistration = false

$taskObservation

private WorkerTaskObservation|null $taskObservation = null

$transientPollRetryObserver read-only

private callable(string, int, float, ServerException): void|null $transientPollRetryObserver = null

$unbindActivityLease

private callable(): void|null $unbindActivityLease = null

$updates

private array<string|int, array<string|int, HandlerDefinition>> $updates = []

$workerId read-only

private string $workerId

$workflowCompletionActivityPollSupported

private bool $workflowCompletionActivityPollSupported = false

$workflowCompletionWorkflowPollSupported

private bool $workflowCompletionWorkflowPollSupported = false

$workflowExecutedLocalActivity

private bool $workflowExecutedLocalActivity = false

$workflowMemoCapability

private array<string, mixed>|null $workflowMemoCapability = null

$workflowPollGrant

private WorkflowPollGrant|null $workflowPollGrant = null

$workflowPollStartedAt

private float|null $workflowPollStartedAt = null

$workflows

private array<string|int, HandlerDefinition> $workflows = []

$workflowTasksInFlight

private int $workflowTasksInFlight = 0

Methods

__construct()

public __construct(Client $client, string $taskQueue[, string|null $workerId = null ][, int $heartbeatIntervalSeconds = self::DEFAULT_HEARTBEAT_INTERVAL_SECONDS ][, string|null $buildId = null ][, Closure|null $clock = null ][, Closure|null $sleeper = null ][, Closure|null $transientPollRetryObserver = null ][, ContainerInterface|null $container = null ][, LoggerInterface|null $logger = null ][, callable|null $diagnosticListener = null ][, int $stickyCacheCapacity = 100 ][, int $stickyCacheTtlSeconds = 300 ][, bool $enableCooperativeCancellation = false ][, bool $enablePreparedLocalActivities = false ][, bool $enableCancellationScopes = false ][, bool $requireQueryTaskAuthority = false ][, ExecutionTelemetry|null $telemetry = null ][, MetricsRecorder|null $metrics = null ][, bool $enableCompletionPipelining = false ][, bool $enableActivityContinuation = false ][, bool $stopOnStaleRegistration = false ]) : mixed
Parameters
$client : Client
$taskQueue : string
$workerId : string|null = null
$heartbeatIntervalSeconds : int = self::DEFAULT_HEARTBEAT_INTERVAL_SECONDS
$buildId : string|null = null
$clock : Closure|null = null
$sleeper : Closure|null = null
$transientPollRetryObserver : Closure|null = null
$container : ContainerInterface|null = null
$logger : LoggerInterface|null = null
$diagnosticListener : callable|null = null
$stickyCacheCapacity : int = 100
$stickyCacheTtlSeconds : int = 300
$enableCooperativeCancellation : bool = false
$enablePreparedLocalActivities : bool = false
$enableCancellationScopes : bool = false
$requireQueryTaskAuthority : bool = false
$telemetry : ExecutionTelemetry|null = null
$metrics : MetricsRecorder|null = null
$enableCompletionPipelining : bool = false
$enableActivityContinuation : bool = false
$stopOnStaleRegistration : bool = false

contracts()

Return the complete local definition sent during worker registration.

public contracts() : array{workflows: list, activities: list, workflow_commands: array}
Return values
array{workflows: list, activities: list, workflow_commands: array}

create()

Construct the preferred class-oriented worker surface.

public static create(Client $client, string $taskQueue[, ContainerInterface|null $container = null ][, LoggerInterface|null $logger = null ][, callable(string, array<string, mixed>): void|null $diagnosticListener = null ][, int $stickyCacheCapacity = 100 ][, int $stickyCacheTtlSeconds = 300 ][, bool $requireQueryTaskAuthority = false ][, ExecutionTelemetry|null $telemetry = null ][, MetricsRecorder|null $metrics = null ][, bool $enableCompletionPipelining = false ]) : self
Parameters
$client : Client
$taskQueue : string
$container : ContainerInterface|null = null
$logger : LoggerInterface|null = null
$diagnosticListener : callable(string, array<string, mixed>): void|null = null
$stickyCacheCapacity : int = 100
$stickyCacheTtlSeconds : int = 300
$requireQueryTaskAuthority : bool = false
$telemetry : ExecutionTelemetry|null = null
$metrics : MetricsRecorder|null = null
$enableCompletionPipelining : bool = false
Return values
self

declareSignal()

Declare a replay-consumed signal and its argument signature.

public declareSignal(string $workflowType, string $signalName[, callable(mixed ...$arguments): mixed|null $signature = null ]) : self

The optional signature is reflected for registration metadata only and is never invoked. Workflows continue to consume signals deterministically through WorkflowContext::signals().

Parameters
$workflowType : string
$signalName : string
$signature : callable(mixed ...$arguments): mixed|null = null
Return values
self

register()

Discover and register one or more attribute-based handler services.

public register(class-string|object ...$services) : self
Parameters
$services : class-string|object
Return values
self

registerActivity()

public registerActivity(string $activityType, callable(ActivityContext, mixed ...$arguments): mixed $handler) : self
Parameters
$activityType : string
$handler : callable(ActivityContext, mixed ...$arguments): mixed
Return values
self

registerQuery()

public registerQuery(string $workflowType, string $queryName, callable(QueryContext, mixed ...$arguments): mixed $handler) : self
Parameters
$workflowType : string
$queryName : string
$handler : callable(QueryContext, mixed ...$arguments): mixed
Return values
self

registerUpdate()

public registerUpdate(string $workflowType, string $updateName, callable(QueryContext, mixed ...$arguments): mixed $handler) : self
Parameters
$workflowType : string
$updateName : string
$handler : callable(QueryContext, mixed ...$arguments): mixed
Return values
self

registerWorkflow()

public registerWorkflow(string $workflowType, callable(WorkflowContext, mixed ...$arguments): mixed $handler) : self
Parameters
$workflowType : string
$handler : callable(WorkflowContext, mixed ...$arguments): mixed
Return values
self

requestShutdown()

Request that run() stop polling and perform its managed cleanup on exit.

public requestShutdown() : void

run()

Register, initialize heartbeat state, poll, and deregister on exit.

public run([int $pollTimeoutSeconds = 5 ]) : void
Parameters
$pollTimeoutSeconds : int = 5

stickyCacheMetrics()

public stickyCacheMetrics() : array{hit: int, miss: int, eviction: int, forced_cold_replay: int}
Return values
array{hit: int, miss: int, eviction: int, forced_cold_replay: int}

tick()

Execute at most one task of each kind during an ordinary tick.

public tick([int $pollTimeoutSeconds = 1 ]) : bool

Shutdown also drains a lease already delivered by a completion. This does not establish or close registration. Use run() for the managed worker lifecycle.

Parameters
$pollTimeoutSeconds : int = 1
Return values
bool

validate()

Validate every registered command contract without contacting the server.

public validate() : void

acknowledgeStoppedRemoteActivity()

This is reached only after the isolated callback stopped and its relay joined.

private acknowledgeStoppedRemoteActivity(string $taskId, string $attemptId, string $leaseOwner) : void
Parameters
$taskId : string
$attemptId : string
$leaseOwner : string

acknowledgeTaskFailure()

private acknowledgeTaskFailure(string $taskKind, string $taskId, Throwable $taskFailure, callable(Throwable): void $failureAcknowledgement[, int|null $workflowTaskAttempt = null ]) : void
Parameters
$taskKind : string
$taskId : string
$taskFailure : Throwable
$failureAcknowledgement : callable(Throwable): void
$workflowTaskAttempt : int|null = null

advertisesGroupedConditionWaits()

private static advertisesGroupedConditionWaits(mixed $capabilities) : bool
Parameters
$capabilities : mixed
Return values
bool

applyHeartbeatInterval()

private applyHeartbeatInterval(array<string, mixed> $response) : void
Parameters
$response : array<string, mixed>

assertCancellationDeadline()

private assertCancellationDeadline() : void

assertCancellationPoliciesAvailable()

private assertCancellationPoliciesAvailable(array<int, array<string, mixed>> $commands) : void
Parameters
$commands : array<int, array<string, mixed>>

assertChildStartTurnAvailable()

A runtime without the capability ignores the unknown await field and would start the child without the parent turn startChildWorkflow() waits for, so the claim is abandoned before anything is submitted.

private assertChildStartTurnAvailable(array<int, array<string, mixed>> $commands) : void
Parameters
$commands : array<int, array<string, mixed>>

assertDiscoveriesCanRegister()

private assertDiscoveriesCanRegister(array<int, DiscoveredHandlers> $discoveries) : void
Parameters
$discoveries : array<int, DiscoveredHandlers>

assertHandlerContext()

private assertHandlerContext(callable $handler, string $contextClass, string $contract) : void
Parameters
$handler : callable
$contextClass : string
$contract : string

assertLocalWorkflowClaimActive()

private assertLocalWorkflowClaimActive(array<string, mixed> $task[, bool $renew = true ]) : void
Parameters
$task : array<string, mixed>
$renew : bool = true

assertPayloadDeadline()

private assertPayloadDeadline(mixed $value) : void
Parameters
$value : mixed

assertPipelineAuthority()

private assertPipelineAuthority() : void

assertRemoteActivityClaimActive()

private assertRemoteActivityClaimActive(array<string, mixed> $task[, RequestBudget|null $budget = null ]) : void
Parameters
$task : array<string, mixed>
$budget : RequestBudget|null = null

assertServiceOperationsAvailable()

private assertServiceOperationsAvailable(array<int, array<string, mixed>> $commands) : void
Parameters
$commands : array<int, array<string, mixed>>

assertSignalNameIsNotRuntimeReserved()

private assertSignalNameIsNotRuntimeReserved(string $signalName) : void
Parameters
$signalName : string

assertSupportedTaskPayloadCodec()

private assertSupportedTaskPayloadCodec(array<string, mixed> $task) : void
Parameters
$task : array<string, mixed>

assertUnique()

private assertUnique(array<string|int, mixed> $registry, string $name, string $kind) : void
Parameters
$registry : array<string|int, mixed>
$name : string
$kind : string

assertValidDeclarationName()

private assertValidDeclarationName(string $name, string $kind[, bool $signalDeclaration = false ]) : void
Parameters
$name : string
$kind : string
$signalDeclaration : bool = false

assertWorkflowMemoUpdatesAvailable()

private assertWorkflowMemoUpdatesAvailable(array<int, array<string, mixed>> $commands) : void
Parameters
$commands : array<int, array<string, mixed>>

authoritativeWorkflowTaskHistory()

Fetch complete durable history after a sticky cache miss.

private authoritativeWorkflowTaskHistory(array<string, mixed> $task, string $leaseOwner, int $attempt) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$leaseOwner : string
$attempt : int
Return values
array<int, array<string, mixed>>

capturePipelineState()

private capturePipelineState() : array<string, mixed>
Return values
array<string, mixed>

captureRegistrationFence()

private captureRegistrationFence(array<string, mixed> $registration) : void
Parameters
$registration : array<string, mixed>

checkpointPreparedLocalPrefix()

private checkpointPreparedLocalPrefix(array<string, mixed> $task, array<int, array<string, mixed>> $commands, int $nextSequence[, bool $scopePrefix = false ][, RequestBudget|null $budget = null ]) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$commands : array<int, array<string, mixed>>
$nextSequence : int
$scopePrefix : bool = false
$budget : RequestBudget|null = null
Return values
array<int, array<string, mixed>>

claimCancellationObservation()

private claimCancellationObservation() : array<string, string>
Return values
array<string, string>

closeWorkerSessions()

private closeWorkerSessions() : void

commandHandlerContracts()

private commandHandlerContracts(array<string|int, HandlerDefinition|callable> $handlers[, class-string|null $contextClass = null ]) : array<int, array{name: string, parameters: list}>
Parameters
$handlers : array<string|int, HandlerDefinition|callable>
$contextClass : class-string|null = null
Return values
array<int, array{name: string, parameters: list}>

completeHistory()

private completeHistory(array<string, mixed> $task, string $leaseOwner, int $attempt) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$leaseOwner : string
$attempt : int
Return values
array<int, array<string, mixed>>

completionPipeliningAvailable()

private completionPipeliningAvailable() : bool
Return values
bool

confirmWorkflowPollGrant()

private confirmWorkflowPollGrant(array<string, mixed> $task, string $taskId, string $owner, int $attempt) : bool
Parameters
$task : array<string, mixed>
$taskId : string
$owner : string
$attempt : int
Return values
bool

crossKindPollWakeReceived()

private crossKindPollWakeReceived(array<string, mixed> $response) : bool
Parameters
$response : array<string, mixed>
Return values
bool

declarationNames()

Restore string declaration names after PHP coerces numeric dictionary keys.

private declarationNames(array<string|int, mixed> $declarations) : array<int, string>
Parameters
$declarations : array<string|int, mixed>
Return values
array<int, string>

decodeArguments()

private decodeArguments(mixed $raw) : array<int, mixed>
Parameters
$raw : mixed
Return values
array<int, mixed>

deregisterWithRetry()

private deregisterWithRetry() : void

diagnoseWorkflowWait()

private diagnoseWorkflowWait(array<string, mixed> $task, array<int, array<string, mixed>> $commands) : void
Parameters
$task : array<string, mixed>
$commands : array<int, array<string, mixed>>

diagnostic()

private diagnostic(string $event[, array<string, mixed> $context = [] ][, string $level = 'info' ]) : void
Parameters
$event : string
$context : array<string, mixed> = []
$level : string = 'info'

discardClosedActivityAttempt()

private discardClosedActivityAttempt(array<string, mixed> $task, ServerException $exception) : bool
Parameters
$task : array<string, mixed>
$exception : ServerException
Return values
bool

discoverGroupedConditionWaitSupport()

Native Server refuses condition waits inside all()/parallel() until it advertises grouped_condition_waits (server#1142). The replayer asks this only when it is about to send such a wait, so ordinary workers never make the extra cluster-info request.

private discoverGroupedConditionWaitSupport(array<string, mixed> $registration) : void
Parameters
$registration : array<string, mixed>

dispatchPolledTask()

private dispatchPolledTask(string $taskKind, array<string, mixed> $task) : void
Parameters
$taskKind : string
$task : array<string, mixed>

drainCarriedWorkflowLease()

private drainCarriedWorkflowLease() : bool
Return values
bool

effectiveBuildId()

private effectiveBuildId() : string
Return values
string

elapsedSinceHeartbeat()

private elapsedSinceHeartbeat() : float
Return values
float

establishRegistration()

private establishRegistration(array<string, mixed> $registration) : void
Parameters
$registration : array<string, mixed>

executeActivityTask()

private executeActivityTask(array<string, mixed> $task) : void
Parameters
$task : array<string, mixed>

executeLocalActivity()

private executeLocalActivity(array<string, mixed> $task, string $activityType, array<int, mixed> $arguments, array<string, mixed> $options) : array<string, mixed>
Parameters
$task : array<string, mixed>
$activityType : string
$arguments : array<int, mixed>
$options : array<string, mixed>
Return values
array<string, mixed>

executePolledTask()

private executePolledTask(string $taskKind, array<string, mixed> $task) : void
Parameters
$taskKind : string
$task : array<string, mixed>

executePreparedLocalActivity()

private executePreparedLocalActivity(array<string, mixed> $task, array<int, array<string, mixed>> $history, ReplayResult $replay) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$history : array<int, array<string, mixed>>
$replay : ReplayResult
Return values
array<int, array<string, mixed>>

executePreparedLocalActivityGroup()

private executePreparedLocalActivityGroup(array<string, mixed> $task, array<int, array<string, mixed>> $history, ReplayResult $replay) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$history : array<int, array<string, mixed>>
$replay : ReplayResult
Return values
array<int, array<string, mixed>>

executeQueryTask()

private executeQueryTask(array<string, mixed> $task) : void
Parameters
$task : array<string, mixed>

executeTask()

private executeTask(string $taskKind, array<string, mixed> $task) : void
Parameters
$taskKind : string
$task : array<string, mixed>

executeUpdate()

private executeUpdate(string $workflowType, string $updateId, array<int, array<string, mixed>> $history, array<string, mixed> $task) : array<string, mixed>
Parameters
$workflowType : string
$updateId : string
$history : array<int, array<string, mixed>>
$task : array<string, mixed>
Return values
array<string, mixed>

executeWorkflowTask()

private executeWorkflowTask(array<string, mixed> $task) : void
Parameters
$task : array<string, mixed>

groupedConditionWaitRefusal()

private groupedConditionWaitRefusal() : string|null
Return values
string|null

haltPolling()

private haltPolling() : void

handlerFailure()

private handlerFailure(string $kind, string $identity, Throwable $exception) : void
Parameters
$kind : string
$identity : string
$exception : Throwable

heartbeat()

private heartbeat([RequestBudget|null $budget = null ]) : void
Parameters
$budget : RequestBudget|null = null

heartbeatIfDue()

private heartbeatIfDue([RequestBudget|null $budget = null ]) : void
Parameters
$budget : RequestBudget|null = null

historyFromTask()

private historyFromTask(array<string, mixed> $task) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
Return values
array<int, array<string, mixed>>

incarnationLabel()

A short fingerprint names the incarnation in logs without exposing its deregistration token.

private static incarnationLabel(string|null $token) : string|null
Parameters
$token : string|null
Return values
string|null

installPipelineState()

private installPipelineState(array<string, mixed> $state) : void
Parameters
$state : array<string, mixed>

installSignalHandlers()

private installSignalHandlers() : void

invokeActivity()

private invokeActivity(callable(ActivityContext, mixed ...$arguments): mixed $handler, ActivityContext $context, array<string|int, mixed> $arguments, array<string|int, mixed> $fields[, bool $local = false ][, array<string|int, mixed>|null $authorizedTask = null ]) : mixed
Parameters
$handler : callable(ActivityContext, mixed ...$arguments): mixed

@param list $arguments @param array<string, mixed> $fields @param array<string, mixed>|null $authorizedTask

$context : ActivityContext
$arguments : array<string|int, mixed>
$fields : array<string|int, mixed>
$local : bool = false
$authorizedTask : array<string|int, mixed>|null = null

isCommittedActivityCompletion()

private isCommittedActivityCompletion(ServerException $exception, array{task_id: string, activity_attempt_id: string, lease_owner: string} $lease) : bool
Parameters
$exception : ServerException
$lease : array{task_id: string, activity_attempt_id: string, lease_owner: string}
Return values
bool

isRunClosedActivityRefusal()

The run closed (complete, fail or continue-as-new) after this activity was claimed, so its outcome or failure report is refused with run_closed and nothing is recorded on the closed run (Workflow #1117, Server #1193).

private isRunClosedActivityRefusal(ServerException $exception) : bool

The refusal is final: the outcome is never retried or re-reported.

Parameters
$exception : ServerException
Return values
bool

isTaskAuthorityLost()

private isTaskAuthorityLost(string $taskKind, string $taskId, Throwable $exception[, int|null $workflowTaskAttempt = null ]) : bool
Parameters
$taskKind : string
$taskId : string
$exception : Throwable
$workflowTaskAttempt : int|null = null
Return values
bool

isTimedOutWorkflowCompletion()

private isTimedOutWorkflowCompletion(array<string, mixed> $task, ServerException $exception) : bool
Parameters
$task : array<string, mixed>
$exception : ServerException
Return values
bool

isTransientDatabaseFailure()

private isTransientDatabaseFailure(ServerException $exception, string $operation[, string|null $pollRequestId = null ]) : bool
Parameters
$exception : ServerException
$operation : string
$pollRequestId : string|null = null
Return values
bool

isTransientWorkflowTaskLeaseRefusal()

private isTransientWorkflowTaskLeaseRefusal(array<string, mixed> $response) : bool
Parameters
$response : array<string, mixed>
Return values
bool

localActivityAttemptId()

private localActivityAttemptId(array<string, mixed> $task, string $activityType, array<int, mixed> $arguments, int $attemptNumber) : string
Parameters
$task : array<string, mixed>
$activityType : string
$arguments : array<int, mixed>
$attemptNumber : int
Return values
string

matchesWorkflowTaskLeaseFence()

private matchesWorkflowTaskLeaseFence(array<string, mixed> $response, string $taskId, string $leaseOwner, int $taskAttempt) : bool
Parameters
$response : array<string, mixed>
$taskId : string
$leaseOwner : string
$taskAttempt : int
Return values
bool

notifyDeliveredWorkflowHistory()

Hand the qualification observer a copy of one attempt's replay input or completion commands. Inert without an observer; observer failures never change the task's outcome.

private notifyDeliveredWorkflowHistory(string $kind, string $taskId, int $attempt, array<int, array<string, mixed>> $items) : void
Parameters
$kind : string
$taskId : string
$attempt : int
$items : array<int, array<string, mixed>>

now()

private now() : float
Return values
float

observeCarriedWorkflowCompletion()

private observeCarriedWorkflowCompletion() : void

observePoll()

private observePoll(string $taskKind, callable(): array<string, mixed> $operation[, float|null $originalStartedAt = null ]) : array<string, mixed>
Parameters
$taskKind : string
$operation : callable(): array<string, mixed>
$originalStartedAt : float|null = null
Return values
array<string, mixed>

observeTaskReadyAge()

private observeTaskReadyAge(string $taskKind, array<string, mixed> $task) : void
Parameters
$taskKind : string
$task : array<string, mixed>

performTick()

private performTick(int $pollTimeoutSeconds) : bool
Parameters
$pollTimeoutSeconds : int
Return values
bool

pipelineTick()

private pipelineTick(int $pollTimeoutSeconds) : bool
Parameters
$pollTimeoutSeconds : int
Return values
bool

pollFailurePolicy()

private pollFailurePolicy(string $kind, string $requestId, ServerException $error) : array{retry: bool, retain: bool}
Parameters
$kind : string
$requestId : string
$error : ServerException
Return values
array{retry: bool, retain: bool}

pollWithRetry()

private pollWithRetry(string $taskKind, callable(string, int): array<string, mixed> $poll, int $requestedTimeoutSeconds[, CarriedPoll|null $carried = null ][, int $previousAttempts = 0 ]) : array<string, mixed>|null
Parameters
$taskKind : string
$poll : callable(string, int): array<string, mixed>
$requestedTimeoutSeconds : int
$carried : CarriedPoll|null = null
$previousAttempts : int = 0
Return values
array<string, mixed>|null

pollWorkflowForTick()

private pollWorkflowForTick(int $pollTimeoutSeconds) : array<string, mixed>|null
Parameters
$pollTimeoutSeconds : int
Return values
array<string, mixed>|null

prepareActivityLeaseMaintenance()

private prepareActivityLeaseMaintenance() : void

prepareCompletionPipeline()

private prepareCompletionPipeline(array<string, mixed> $task, array<int, array<string, mixed>> $commands) : void
Parameters
$task : array<string, mixed>
$commands : array<int, array<string, mixed>>

prepareLocalCallback()

private prepareLocalCallback(array<string, mixed> $task, PreparedLocalActivityCall $call) : Closure}
Parameters
$task : array<string, mixed>
$call : PreparedLocalActivityCall
Return values
Closure}

preparePoll()

private preparePoll(int $requestedTimeoutSeconds) : int
Parameters
$requestedTimeoutSeconds : int
Tags
phpstan-impure
Return values
int

queryAuthorityForTask()

private queryAuthorityForTask(array<string, mixed> $task) : QueryTaskAuthority|null
Parameters
$task : array<string, mixed>
Return values
QueryTaskAuthority|null

queryRequestBudget()

private queryRequestBudget(QueryTaskAuthority|null $authority) : RequestBudget|null
Parameters
$authority : QueryTaskAuthority|null
Return values
RequestBudget|null

recoversFromStaleRegistration()

Only run() recovers, only from the Server's own stale-registration answer, and never past a requested shutdown.

private recoversFromStaleRegistration(Throwable $exception) : bool
Parameters
$exception : Throwable
Return values
bool

recoverStaleRegistration()

The Server has fenced this incarnation. Every claim it held is dropped without completing, failing or heartbeating it, because lease expiry redelivers that work. The worker then registers again, which rotates the incarnation token. Consecutive recoveries back off with jitter so this can never loop tightly.

private recoverStaleRegistration() : bool
Return values
bool

refreshCancellationHistory()

private refreshCancellationHistory(array<string, mixed> $task) : array<string|int, mixed>
Parameters
$task : array<string, mixed>

@return list<array<string, mixed>>

Return values
array<string|int, mixed>

refreshPreparedLocalHistory()

private refreshPreparedLocalHistory(array<string, mixed> $task, array<string, mixed> $receipt) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$receipt : array<string, mixed>
Return values
array<int, array<string, mixed>>

refreshWorkflowClaimHistory()

private refreshWorkflowClaimHistory(array<string, mixed> $task, string $token[, bool $requireCancellation = false ][, RequestBudget|null $budget = null ]) : array<int, array<string, mixed>>
Parameters
$task : array<string, mixed>
$token : string
$requireCancellation : bool = false
$budget : RequestBudget|null = null
Return values
array<int, array<string, mixed>>

registerActivityDefinition()

private registerActivityDefinition(string $activityType, HandlerDefinition $handler) : self
Parameters
$activityType : string
$handler : HandlerDefinition
Return values
self

registerQueryDefinition()

private registerQueryDefinition(string $workflowType, string $queryName, HandlerDefinition $handler) : self
Parameters
$workflowType : string
$queryName : string
$handler : HandlerDefinition
Return values
self

registerUpdateDefinition()

private registerUpdateDefinition(string $workflowType, string $updateName, HandlerDefinition $handler) : self
Parameters
$workflowType : string
$updateName : string
$handler : HandlerDefinition
Return values
self

registerWithRetry()

private registerWithRetry() : array<string, mixed>|null
Return values
array<string, mixed>|null

registerWorkflowDefinition()

private registerWorkflowDefinition(string $workflowType, HandlerDefinition $handler) : self
Parameters
$workflowType : string
$handler : HandlerDefinition
Return values
self

rejectPolledTask()

private rejectPolledTask(string $taskKind, array<string, mixed> $task, CodecException $exception) : void
Parameters
$taskKind : string
$task : array<string, mixed>
$exception : CodecException

rememberCarriedPollCapabilities()

private rememberCarriedPollCapabilities(array<string, mixed> $response) : void
Parameters
$response : array<string, mixed>

rememberWorkflowMemoCapability()

private rememberWorkflowMemoCapability(array<string, mixed> $poll) : void
Parameters
$poll : array<string, mixed>

rememberWorkflowPollCapabilities()

private rememberWorkflowPollCapabilities(array<string, mixed> $response) : void
Parameters
$response : array<string, mixed>

renewWorkflowTaskLease()

private renewWorkflowTaskLease(string $taskId, string $leaseOwner, int $taskAttempt) : bool
Parameters
$taskId : string
$leaseOwner : string
$taskAttempt : int
Return values
bool

replayWorkflowClaim()

private replayWorkflowClaim(callable(WorkflowContext, mixed ...$input): mixed $handler, array<string|int, mixed> $history, array<string|int, mixed> $input, array<string|int, mixed> $task) : ReplayResult
Parameters
$handler : callable(WorkflowContext, mixed ...$input): mixed

@param list<array<string, mixed>> $history @param list $input @param array<string, mixed> $task

$history : array<string|int, mixed>
$input : array<string|int, mixed>
$task : array<string|int, mixed>
Return values
ReplayResult

reserveActivityPoll()

private reserveActivityPoll(string $leaseOwner, bool $completing) : CarriedPoll|null
Parameters
$leaseOwner : string
$completing : bool
Return values
CarriedPoll|null

reserveWorkflowPoll()

private reserveWorkflowPoll(string $leaseOwner[, bool $workflowCompletion = false ]) : CarriedPoll|null
Parameters
$leaseOwner : string
$workflowCompletion : bool = false
Return values
CarriedPoll|null

resetPipelineState()

private resetPipelineState() : void

resumePipelineFiber()

private resumePipelineFiber(Fiber<mixed, mixed> $parent, array<string, mixed> $state) : void
Parameters
$parent : Fiber<mixed, mixed>
$state : array<string, mixed>

retryStoppedRemoteActivityReceiptRequest()

private retryStoppedRemoteActivityReceiptRequest(callable(): array<string, mixed> $request, RequestBudget $budget) : array<string, mixed>
Parameters
$request : callable(): array<string, mixed>
$budget : RequestBudget
Return values
array<string, mixed>

retryStorageAdmission()

private retryStorageAdmission(string $operation, callable(): T $request[, array{task_id: string, lease_owner: string, attempt: int}|null $workflowTaskLease = null ][, array{task_id: string, activity_attempt_id: string, lease_owner: string}|null $activityTaskLease = null ]) : T
Parameters
$operation : string
$request : callable(): T
$workflowTaskLease : array{task_id: string, lease_owner: string, attempt: int}|null = null
$activityTaskLease : array{task_id: string, activity_attempt_id: string, lease_owner: string}|null = null
Tags
template
Return values
T

settleRunClosedActivityRefusal()

An abandon-policy activity its run left running at close still closes with its own outcome; the Server answers run_closed because nothing is appended to the closed run. That is success for this Worker. Any other run_closed refusal means the close cancelled the activity.

private settleRunClosedActivityRefusal(string $taskKind, string $taskId, Throwable $failure) : bool
Parameters
$taskKind : string
$taskId : string
$failure : Throwable
Return values
bool

speculateActivityContinuation()

Server #1078: replay the activity's run with its own result appended and return the next workflow commands, or null for the ordinary completion. The replay has no local executor, preparation, checkpoint or scope delivery, so it makes no request. It is abandoned when the workflow reads business time the server has not assigned yet, or produces anything outside the advertised v1 command set. The server still decides; a decline is always safe.

private speculateActivityContinuation(array<string, mixed> $task, mixed $result) : array{version: int, history_through_sequence: int, history_last_event_id: string, commands: list>}|null
Parameters
$task : array<string, mixed>
$result : mixed
Return values
array{version: int, history_through_sequence: int, history_last_event_id: string, commands: list>}|null

staleRegistrationPoll()

private staleRegistrationPoll(array<string, mixed> $response) : bool
Parameters
$response : array<string, mixed>
Return values
bool

stickyCacheClaim()

private stickyCacheClaim(array<string, mixed> $task) : array{worker_id: string, workflow_id: string, run_id: string, build_id: string, ttl_seconds: int, metrics: array{hit: int, miss: int, eviction: int, forced_cold_replay: int}}|null
Parameters
$task : array<string, mixed>
Return values
array{worker_id: string, workflow_id: string, run_id: string, build_id: string, ttl_seconds: int, metrics: array{hit: int, miss: int, eviction: int, forced_cold_replay: int}}|null

stopActivityLease()

private stopActivityLease() : void

stopForTerminalPoll()

private stopForTerminalPoll(array<string, mixed> $response) : bool
Parameters
$response : array<string, mixed>
Return values
bool

taskFromPoll()

private taskFromPoll(array<string, mixed> $response) : array<string, mixed>|null
Parameters
$response : array<string, mixed>
Return values
array<string, mixed>|null

trackWorkerSessionFromTask()

private trackWorkerSessionFromTask(array<string, mixed> $task) : void
Parameters
$task : array<string, mixed>

transientRetryDelay()

private transientRetryDelay(int $attempt, mixed $retryAfterSeconds) : float
Parameters
$attempt : int
$retryAfterSeconds : mixed
Return values
float

validHeartbeatInterval()

private validHeartbeatInterval(mixed $interval) : int|null
Parameters
$interval : mixed
Return values
int|null

waitForTransientRetry()

private waitForTransientRetry(float $delaySeconds) : void
Parameters
$delaySeconds : float

workerPayloadProgress()

private workerPayloadProgress(string $path, array<string, mixed>|null $body, array<string, mixed> $response, RequestBudget|null $budget) : callable(): void|null
Parameters
$path : string
$body : array<string, mixed>|null
$response : array<string, mixed>
$budget : RequestBudget|null
Return values
callable(): void|null

workflowCommandContracts()

private workflowCommandContracts() : array<string|int, array{queries: list, query_contracts: list}>, signals: list, signal_contracts: list}>, updates: list, update_validators: list, update_contracts: list}>}>
Return values
array<string|int, array{queries: list, query_contracts: list}>, signals: list, signal_contracts: list}>, updates: list, update_validators: list, update_contracts: list}>}>

workflowDefinitionFingerprints()

private workflowDefinitionFingerprints() : array<string|int, string>
Return values
array<string|int, string>

workflowFailureCommand()

private workflowFailureCommand(Throwable $exception[, int|null $failedActivitySequence = null ][, string|null $failedActivityExecutionId = null ]) : array<string, mixed>
Parameters
$exception : Throwable
$failedActivitySequence : int|null = null
$failedActivityExecutionId : string|null = null
Return values
array<string, mixed>

workflowTaskLeaseResponseFailure()

private workflowTaskLeaseResponseFailure(string $fallbackMessage, array<string, mixed> $response) : ServerException
Parameters
$fallbackMessage : string
$response : array<string, mixed>
Return values
ServerException
On this page

Search results