WorkerOptions
in package
Tags
Table of Contents
Properties
- $deadlockDetectionTimeout : DateInterval|null
- Optional: If set defines maximum amount of time that workflow task will be allowed to run.
- $disableEagerActivities : bool
- Optional: Disable eager activities. If set to true, activities will not be requested to execute eagerly from the same workflow regardless of {@see self::$maxConcurrentEagerActivityExecutionSize}.
- $disableRegistrationAliasing : bool
- Optional: Disable allowing workflow and activity functions that are registered with custom names from being able to be called with their function references.
- $disableWorkflowWorker : bool
- Optional: If set to true, a workflow worker is not started for this worker and workflows cannot be registered with this worker. Use this if you only want your worker to execute activities.
- $enableLoggingInReplay : bool
- Optional: Enable logging in replay.
- $enableSessionWorker : bool
- Optional: Enable running session workers.
- $identity : string
- Optional: If set overwrites the client level Identify value.
- $localActivityWorkerOnly : bool
- Optional: If set to true worker would only handle workflow tasks and local activities.
- $maxConcurrentActivityExecutionSize : int
- Optional: To set the maximum concurrent activity executions this worker can have.
- $maxConcurrentActivityTaskPollers : int
- Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve activity tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
- $maxConcurrentEagerActivityExecutionSize : int
- Optional: Maximum number of eager activities that can be running.
- $maxConcurrentLocalActivityExecutionSize : int
- Optional: To set the maximum concurrent local activity executions this worker can have.
- $maxConcurrentNexusTaskExecutionSize : int
- Optional: Sets the maximum concurrent nexus task executions this worker can have.
- $maxConcurrentNexusTaskPollers : int
- Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve nexus tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
- $maxConcurrentSessionExecutionSize : int
- Optional: Sets the maximum number of concurrently running sessions the resource supports.
- $maxConcurrentWorkflowTaskExecutionSize : int
- Optional: To set the maximum concurrent workflow task executions this worker can have.
- $maxConcurrentWorkflowTaskPollers : int
- Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve workflow tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue. Due to internal logic where pollers alternate between stick and non-sticky queues, this value cannot be 1 and will panic if set to that value.
- $maxHeartbeatThrottleInterval : DateInterval|null
- Optional: The default amount of time between sending each pending heartbeat to the server.
- $sessionResourceId : string|null
- Optional: The identifier of the resource consumed by sessions.
- $stickyScheduleToStartTimeout : DateInterval|null
- Optional: Sticky schedule to start timeout.
- $taskQueueActivitiesPerSecond : float
- Optional: Sets the rate limiting on number of activities that can be executed per second.
- $workerActivitiesPerSecond : float
- Optional: Sets the rate limiting on number of activities that can be executed per second per worker. This can be used to limit resources used by the worker.
- $workerLocalActivitiesPerSecond : float
- Optional: Sets the rate limiting on number of local activities that can be executed per second per worker. This can be used to limit resources used by the worker.
- $workerStopTimeout : DateInterval|null
- Optional: worker graceful stop timeout.
- $workflowPanicPolicy : WorkflowPanicPolicy
- Optional: Sets how workflow worker deals with non-deterministic history events (presumably arising from non-deterministic workflow definitions or non-backward compatible workflow definition changes) and other panics raised from workflow code.
Methods
- new() : self
- withDeadlockDetectionTimeout() : self
- Optional: If set defines maximum amount of time that workflow task will be allowed to run.
- withDisableEagerActivities() : self
- Optional: Disable eager activities. If set to true, activities will not be requested to execute eagerly from the same workflow regardless of {@see self::$maxConcurrentEagerActivityExecutionSize}.
- withDisableRegistrationAliasing() : self
- Optional: Disable allowing workflow and activity functions that are registered with custom names from being able to be called with their function references.
- withDisableWorkflowWorker() : self
- Optional: If set to true, a workflow worker is not started for this worker and workflows cannot be registered with this worker. Use this if you only want your worker to execute activities.
- withEnableLoggingInReplay() : self
- Optional: Enable logging in replay.
- withEnableSessionWorker() : self
- Optional: Enable running session workers.
- withIdentity() : self
- Optional: If set overwrites the client level Identify value.
- withLocalActivityWorkerOnly() : self
- Optional: If set to true worker would only handle workflow tasks and local activities.
- withMaxConcurrentActivityExecutionSize() : self
- Optional: To set the maximum concurrent activity executions this worker can have.
- withMaxConcurrentActivityTaskPollers() : self
- Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve activity tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
- withMaxConcurrentEagerActivityExecutionSize() : self
- Optional: Maximum number of eager activities that can be running.
- withMaxConcurrentLocalActivityExecutionSize() : self
- Optional: To set the maximum concurrent local activity executions this worker can have.
- withMaxConcurrentNexusTaskExecutionSize() : self
- Optional: Sets the maximum concurrent nexus task executions this worker can have.
- withMaxConcurrentNexusTaskPollers() : self
- Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve nexus tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
- withMaxConcurrentSessionExecutionSize() : self
- Optional: Sets the maximum number of concurrently running sessions the resource support.
- withMaxConcurrentWorkflowTaskExecutionSize() : self
- Optional: To set the maximum concurrent workflow task executions this worker can have.
- withMaxConcurrentWorkflowTaskPollers() : self
- Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve workflow tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue. Due to internal logic where pollers alternate between stick and non-sticky queues, this value cannot be 1 and will panic if set to that value.
- withMaxHeartbeatThrottleInterval() : self
- Optional: The default amount of time between sending each pending heartbeat to the server.
- withSessionResourceId() : self
- Optional: The identifier of the resource consumed by sessions.
- withStickyScheduleToStartTimeout() : self
- Optional: Sticky schedule to start timeout.
- withTaskQueueActivitiesPerSecond() : self
- Optional: Sets the rate limiting on number of activities that can be executed per second.
- withWorkerActivitiesPerSecond() : self
- Optional: Sets the rate limiting on number of activities that can be executed per second per worker. This can be used to limit resources used by the worker.
- withWorkerLocalActivitiesPerSecond() : self
- Optional: Sets the rate limiting on number of local activities that can be executed per second per worker. This can be used to limit resources used by the worker.
- withWorkerStopTimeout() : self
- Optional: worker graceful stop timeout.
- withWorkflowPanicPolicy() : self
- Optional: Sets how workflow worker deals with non-deterministic history events (presumably arising from non-deterministic workflow definitions or non-backward compatible workflow definition changes) and other panics raised from workflow code.
Properties
$deadlockDetectionTimeout
Optional: If set defines maximum amount of time that workflow task will be allowed to run.
public
DateInterval|null
$deadlockDetectionTimeout
= null
Default: 1 sec.
$disableEagerActivities
Optional: Disable eager activities. If set to true, activities will not be requested to execute eagerly from the same workflow regardless of {@see self::$maxConcurrentEagerActivityExecutionSize}.
public
bool
$disableEagerActivities
= false
Eager activity execution means the server returns requested eager activities directly from the workflow task back to this worker which is faster than non-eager which may be dispatched to a separate worker.
Tags
$disableRegistrationAliasing
Optional: Disable allowing workflow and activity functions that are registered with custom names from being able to be called with their function references.
public
bool
$disableRegistrationAliasing
= false
Users are strongly recommended to set this as true if they register any workflow or activity functions with custom names. By leaving this as false, the historical default, ambiguity can occur between function names and aliased names when not using string names when executing child workflow or activities.
$disableWorkflowWorker
Optional: If set to true, a workflow worker is not started for this worker and workflows cannot be registered with this worker. Use this if you only want your worker to execute activities.
public
bool
$disableWorkflowWorker
= false
$enableLoggingInReplay
Optional: Enable logging in replay.
public
bool
$enableLoggingInReplay
= false
In the workflow code you can use workflow.GetLogger(ctx) to write logs. By default, the logger will skip log entry during replay mode so you won't see duplicate logs. This option will enable the logging in replay mode. This is only useful for debugging purpose.
$enableSessionWorker
Optional: Enable running session workers.
public
bool
$enableSessionWorker
= false
Session workers is for activities within a session. Enable this option to allow worker to process sessions.
$identity
Optional: If set overwrites the client level Identify value.
public
string
$identity
= ''
default: client identity
$localActivityWorkerOnly
Optional: If set to true worker would only handle workflow tasks and local activities.
public
bool
$localActivityWorkerOnly
= false
Non-local activities will not be executed by this worker.
$maxConcurrentActivityExecutionSize
Optional: To set the maximum concurrent activity executions this worker can have.
public
int
$maxConcurrentActivityExecutionSize
= 0
The zero value of this uses the default value.
$maxConcurrentActivityTaskPollers
Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve activity tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
public
int
$maxConcurrentActivityTaskPollers
= 0
$maxConcurrentEagerActivityExecutionSize
Optional: Maximum number of eager activities that can be running.
public
int
$maxConcurrentEagerActivityExecutionSize
= 0
When non-zero, eager activity execution will not be requested for activities schedule by the workflow if it would cause the total number of running eager activities to exceed this value. For example, if this is set to 1000 and there are already 998 eager activities executing and a workflow task schedules 3 more, only the first 2 will request eager execution.
The default of 0 means unlimited and therefore only bound by self::$maxConcurrentActivityExecutionSize.
Tags
$maxConcurrentLocalActivityExecutionSize
Optional: To set the maximum concurrent local activity executions this worker can have.
public
int
$maxConcurrentLocalActivityExecutionSize
= 0
The zero value of this uses the default value.
$maxConcurrentNexusTaskExecutionSize
Optional: Sets the maximum concurrent nexus task executions this worker can have.
public
int
$maxConcurrentNexusTaskExecutionSize
= 0
The zero value of this uses the default value.
$maxConcurrentNexusTaskPollers
Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve nexus tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
public
int
$maxConcurrentNexusTaskPollers
= 0
$maxConcurrentSessionExecutionSize
Optional: Sets the maximum number of concurrently running sessions the resource supports.
public
int
$maxConcurrentSessionExecutionSize
= 1000
$maxConcurrentWorkflowTaskExecutionSize
Optional: To set the maximum concurrent workflow task executions this worker can have.
public
int
$maxConcurrentWorkflowTaskExecutionSize
= 0
The zero value of this uses the default value. Due to internal logic where pollers alternate between stick and non-sticky queues, this value cannot be 1 and will panic if set to that value.
$maxConcurrentWorkflowTaskPollers
Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve workflow tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue. Due to internal logic where pollers alternate between stick and non-sticky queues, this value cannot be 1 and will panic if set to that value.
public
int
$maxConcurrentWorkflowTaskPollers
= 0
$maxHeartbeatThrottleInterval
Optional: The default amount of time between sending each pending heartbeat to the server.
public
DateInterval|null
$maxHeartbeatThrottleInterval
= null
This is used if the ActivityOptions do not provide a HeartbeatTimeout. Otherwise, the interval becomes a value a bit smaller than the given HeartbeatTimeout.
Default: 30 seconds
$sessionResourceId
Optional: The identifier of the resource consumed by sessions.
public
string|null
$sessionResourceId
= null
It's the user's responsibility to ensure there's only one worker using this resourceID.
For now, if user doesn't specify one, a new uuid will be used as the resourceID.
$stickyScheduleToStartTimeout
Optional: Sticky schedule to start timeout.
public
DateInterval|null
$stickyScheduleToStartTimeout
= null
The resolution is seconds.
Sticky Execution is to run the workflow tasks for one workflow execution on same worker host. This is an optimization for workflow execution. When sticky execution is enabled, worker keeps the workflow state in memory. New workflow task contains the new history events will be dispatched to the same worker. If this worker crashes, the sticky workflow task will timeout after StickyScheduleToStartTimeout, and temporal server will clear the stickiness for that workflow execution and automatically reschedule a new workflow task that is available for any worker to pick up and resume the progress.
Default: 5s
$taskQueueActivitiesPerSecond
Optional: Sets the rate limiting on number of activities that can be executed per second.
public
float
$taskQueueActivitiesPerSecond
= 0
This is managed by the server and controls activities per second for your entire taskqueue whereas WorkerActivityTasksPerSecond controls activities only per worker.
Notice that the number is represented in float, so that you can set it to less than 1 if needed. For example, set the number to 0.1 means you want your activity to be executed once for every 10 seconds. This can be used to protect down stream services from flooding.
The zero value of this uses the default value.
Tags
$workerActivitiesPerSecond
Optional: Sets the rate limiting on number of activities that can be executed per second per worker. This can be used to limit resources used by the worker.
public
float
$workerActivitiesPerSecond
= 0
Notice that the number is represented in float, so that you can set it to less than 1 if needed. For example, set the number to 0.1 means you want your activity to be executed once for every 10 seconds. This can be used to protect down stream services from flooding. The zero value of this uses the default value.
$workerLocalActivitiesPerSecond
Optional: Sets the rate limiting on number of local activities that can be executed per second per worker. This can be used to limit resources used by the worker.
public
float
$workerLocalActivitiesPerSecond
= 0
Notice that the number is represented in float, so that you can set it to less than 1 if needed. For example, set the number to 0.1 means you want your local activity to be executed once for every 10 seconds. This can be used to protect down stream services from flooding.
The zero value of this uses the default value.
$workerStopTimeout
Optional: worker graceful stop timeout.
public
DateInterval|null
$workerStopTimeout
= null
$workflowPanicPolicy
Optional: Sets how workflow worker deals with non-deterministic history events (presumably arising from non-deterministic workflow definitions or non-backward compatible workflow definition changes) and other panics raised from workflow code.
public
WorkflowPanicPolicy
$workflowPanicPolicy
= \Temporal\Worker\WorkflowPanicPolicy::BlockWorkflow
Methods
new()
public
static new() : self
Return values
selfwithDeadlockDetectionTimeout()
Optional: If set defines maximum amount of time that workflow task will be allowed to run.
public
withDeadlockDetectionTimeout(DateIntervalValue $timeout) : self
Default: 1 sec.
Parameters
- $timeout : DateIntervalValue
Tags
Return values
selfwithDisableEagerActivities()
Optional: Disable eager activities. If set to true, activities will not be requested to execute eagerly from the same workflow regardless of {@see self::$maxConcurrentEagerActivityExecutionSize}.
public
withDisableEagerActivities([bool $disable = true ]) : self
Eager activity execution means the server returns requested eager activities directly from the workflow task back to this worker which is faster than non-eager which may be dispatched to a separate worker.
Parameters
- $disable : bool = true
Tags
Return values
selfwithDisableRegistrationAliasing()
Optional: Disable allowing workflow and activity functions that are registered with custom names from being able to be called with their function references.
public
withDisableRegistrationAliasing([bool $disable = true ]) : self
Users are strongly recommended to set this as true if they register any workflow or activity functions with custom names. By leaving this as false, the historical default, ambiguity can occur between function names and aliased names when not using string names when executing child workflow or activities.
Parameters
- $disable : bool = true
Return values
selfwithDisableWorkflowWorker()
Optional: If set to true, a workflow worker is not started for this worker and workflows cannot be registered with this worker. Use this if you only want your worker to execute activities.
public
withDisableWorkflowWorker([bool $disable = true ]) : self
Parameters
- $disable : bool = true
Return values
selfwithEnableLoggingInReplay()
Optional: Enable logging in replay.
public
withEnableLoggingInReplay([bool $enable = true ]) : self
In the workflow code you can use workflow.GetLogger(ctx) to write logs. By default, the logger will skip log entry during replay mode so you won't see duplicate logs. This option will enable the logging in replay mode. This is only useful for debugging purpose.
Parameters
- $enable : bool = true
Return values
selfwithEnableSessionWorker()
Optional: Enable running session workers.
public
withEnableSessionWorker([bool $enable = true ]) : self
Session workers is for activities within a session. Enable this option to allow worker to process sessions.
Parameters
- $enable : bool = true
Return values
selfwithIdentity()
Optional: If set overwrites the client level Identify value.
public
withIdentity(non-empty-string $identity) : self
default: client identity
Parameters
- $identity : non-empty-string
Return values
selfwithLocalActivityWorkerOnly()
Optional: If set to true worker would only handle workflow tasks and local activities.
public
withLocalActivityWorkerOnly([bool $localOnly = true ]) : self
Non-local activities will not be executed by this worker.
Parameters
- $localOnly : bool = true
Return values
selfwithMaxConcurrentActivityExecutionSize()
Optional: To set the maximum concurrent activity executions this worker can have.
public
withMaxConcurrentActivityExecutionSize(int<0, max> $size) : self
The zero value of this uses the default value.
Parameters
- $size : int<0, max>
Tags
Return values
selfwithMaxConcurrentActivityTaskPollers()
Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve activity tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
public
withMaxConcurrentActivityTaskPollers(int<0, max> $pollers) : self
Parameters
- $pollers : int<0, max>
Tags
Return values
selfwithMaxConcurrentEagerActivityExecutionSize()
Optional: Maximum number of eager activities that can be running.
public
withMaxConcurrentEagerActivityExecutionSize(int $size) : self
When non-zero, eager activity execution will not be requested for activities schedule by the workflow if it would cause the total number of running eager activities to exceed this value. For example, if this is set to 1000 and there are already 998 eager activities executing and a workflow task schedules 3 more, only the first 2 will request eager execution.
The default of 0 means unlimited and therefore only bound by self::$maxConcurrentActivityExecutionSize.
Parameters
- $size : int
Tags
Return values
selfwithMaxConcurrentLocalActivityExecutionSize()
Optional: To set the maximum concurrent local activity executions this worker can have.
public
withMaxConcurrentLocalActivityExecutionSize(int<0, max> $size) : self
The zero value of this uses the default value.
Parameters
- $size : int<0, max>
Tags
Return values
selfwithMaxConcurrentNexusTaskExecutionSize()
Optional: Sets the maximum concurrent nexus task executions this worker can have.
public
withMaxConcurrentNexusTaskExecutionSize(int<0, max> $size) : self
The zero value of this uses the default value.
Parameters
- $size : int<0, max>
Return values
selfwithMaxConcurrentNexusTaskPollers()
Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve nexus tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue.
public
withMaxConcurrentNexusTaskPollers(int<0, max> $pollers) : self
Parameters
- $pollers : int<0, max>
Return values
selfwithMaxConcurrentSessionExecutionSize()
Optional: Sets the maximum number of concurrently running sessions the resource support.
public
withMaxConcurrentSessionExecutionSize(int<0, max> $size) : self
Parameters
- $size : int<0, max>
Tags
Return values
selfwithMaxConcurrentWorkflowTaskExecutionSize()
Optional: To set the maximum concurrent workflow task executions this worker can have.
public
withMaxConcurrentWorkflowTaskExecutionSize(int<0, max> $size) : self
The zero value of this uses the default value. Due to internal logic where pollers alternate between stick and non-sticky queues, this value cannot be 1 and will panic if set to that value.
Parameters
- $size : int<0, max>
Tags
Return values
selfwithMaxConcurrentWorkflowTaskPollers()
Optional: Sets the maximum number of goroutines that will concurrently poll the temporal-server to retrieve workflow tasks. Changing this value will affect the rate at which the worker is able to consume tasks from a task queue. Due to internal logic where pollers alternate between stick and non-sticky queues, this value cannot be 1 and will panic if set to that value.
public
withMaxConcurrentWorkflowTaskPollers(int<0, max> $pollers) : self
Parameters
- $pollers : int<0, max>
Tags
Return values
selfwithMaxHeartbeatThrottleInterval()
Optional: The default amount of time between sending each pending heartbeat to the server.
public
withMaxHeartbeatThrottleInterval(DateIntervalValue $interval) : self
This is used if the ActivityOptions do not provide a HeartbeatTimeout. Otherwise, the interval becomes a value a bit smaller than the given HeartbeatTimeout.
Default: 30 seconds
Parameters
- $interval : DateIntervalValue
Tags
Return values
selfwithSessionResourceId()
Optional: The identifier of the resource consumed by sessions.
public
withSessionResourceId(string|null $identifier) : self
It's the user's responsibility to ensure there's only one worker using this resourceID.
For now, if user doesn't specify one, a new uuid will be used as the resourceID.
Parameters
- $identifier : string|null
Return values
selfwithStickyScheduleToStartTimeout()
Optional: Sticky schedule to start timeout.
public
withStickyScheduleToStartTimeout(DateIntervalValue $timeout) : self
Sticky Execution is to run the workflow tasks for one workflow execution on same worker host. This is an optimization for workflow execution. When sticky execution is enabled, worker keeps the workflow state in memory. New workflow task contains the new history events will be dispatched to the same worker. If this worker crashes, the sticky workflow task will timeout after StickyScheduleToStartTimeout, and temporal server will clear the stickiness for that workflow execution and automatically reschedule a new workflow task that is available for any worker to pick up and resume the progress.
Parameters
- $timeout : DateIntervalValue
Tags
Return values
selfwithTaskQueueActivitiesPerSecond()
Optional: Sets the rate limiting on number of activities that can be executed per second.
public
withTaskQueueActivitiesPerSecond(float $interval) : self
This is managed by the server and controls activities per second for your entire taskqueue whereas WorkerActivityTasksPerSecond controls activities only per worker.
Notice that the number is represented in float, so that you can set it to less than 1 if needed. For example, set the number to 0.1 means you want your activity to be executed once for every 10 seconds. This can be used to protect down stream services from flooding.
The zero value of this uses the default value.
Parameters
- $interval : float
Tags
Return values
selfwithWorkerActivitiesPerSecond()
Optional: Sets the rate limiting on number of activities that can be executed per second per worker. This can be used to limit resources used by the worker.
public
withWorkerActivitiesPerSecond(float $interval) : self
Notice that the number is represented in float, so that you can set it to less than 1 if needed. For example, set the number to 0.1 means you want your activity to be executed once for every 10 seconds. This can be used to protect down stream services from flooding. The zero value of this uses the default value.
Parameters
- $interval : float
Tags
Return values
selfwithWorkerLocalActivitiesPerSecond()
Optional: Sets the rate limiting on number of local activities that can be executed per second per worker. This can be used to limit resources used by the worker.
public
withWorkerLocalActivitiesPerSecond(float $interval) : self
Notice that the number is represented in float, so that you can set it to less than 1 if needed. For example, set the number to 0.1 means you want your local activity to be executed once for every 10 seconds. This can be used to protect down stream services from flooding.
The zero value of this uses the default value.
Parameters
- $interval : float
Tags
Return values
selfwithWorkerStopTimeout()
Optional: worker graceful stop timeout.
public
withWorkerStopTimeout(DateIntervalValue $timeout) : self
Parameters
- $timeout : DateIntervalValue
Tags
Return values
selfwithWorkflowPanicPolicy()
Optional: Sets how workflow worker deals with non-deterministic history events (presumably arising from non-deterministic workflow definitions or non-backward compatible workflow definition changes) and other panics raised from workflow code.
public
withWorkflowPanicPolicy(WorkflowPanicPolicy $policy) : self
Parameters
- $policy : WorkflowPanicPolicy