ActivityOptions
extends Options
in package
implements
ActivityOptionsInterface
ActivityOptions stores all activity-specific parameters that will be stored inside of a context.
The current timeout resolution implementation is in seconds and uses ceil($interval->s)
as the duration.
But is subjected to change in the future.
Tags
Table of Contents
Interfaces
- ActivityOptionsInterface
- A marker interface for ActivityOptions and LocalActivityOptions
Properties
- $activityId : string
- Business level activity ID, this is not needed for most of the cases if you have to specify this then talk to temporal team.
- $cancellationType : int
- Whether to wait for canceled activity to be completed(activity can be failed, completed, cancel accepted).
- $heartbeatTimeout : DateInterval
- The periodic timeout while the activity is in execution.
- $retryOptions : RetryOptions|null
- RetryPolicy specifies how to retry an Activity if an error occurs.
- $scheduleToCloseTimeout : DateInterval
- The end to end timeout for the activity needed. The zero value of this uses default value.
- $scheduleToStartTimeout : DateInterval
- The queue timeout before the activity starts executed.
- $startToCloseTimeout : DateInterval
- The timeout from the start of execution to end of it.
- $taskQueue : string|null
- TaskQueue that the activity needs to be scheduled on.
Methods
- __construct() : mixed
- ActivityOptions constructor.
- mergeWith() : $this
- withActivityId() : $this
- withCancellationType() : $this
- withHeartbeatTimeout() : $this
- Heartbeat interval.
- withRetryOptions() : $this
- withScheduleToCloseTimeout() : $this
- Overall timeout workflow is willing to wait for activity to complete.
- withScheduleToStartTimeout() : $this
- Time activity can stay in task queue before it is picked up by a worker.
- withStartToCloseTimeout() : $this
- Maximum activity execution time after it was sent to a worker.
- withTaskQueue() : $this
- Task queue to use when dispatching activity task to a worker.
Properties
$activityId
Business level activity ID, this is not needed for most of the cases if you have to specify this then talk to temporal team.
public
string
$activityId
= ''
This is something will be done in the future.
$cancellationType
Whether to wait for canceled activity to be completed(activity can be failed, completed, cancel accepted).
public
int
$cancellationType
= \Temporal\Activity\ActivityCancellationType::TRY_CANCEL
Tags
$heartbeatTimeout
The periodic timeout while the activity is in execution.
public
DateInterval
$heartbeatTimeout
This is the max interval the server needs to hear at-least one ping from the activity.
$retryOptions
RetryPolicy specifies how to retry an Activity if an error occurs.
public
RetryOptions|null
$retryOptions
= null
More details are available at . RetryPolicy is optional. If one is not specified a default RetryPolicy is provided by the server.
The default RetryPolicy provided by the server specifies:
- InitialInterval of 1 second
- BackoffCoefficient of 2.0
- MaximumInterval of 100 x InitialInterval
- MaximumAttempts of 0 (unlimited)
To disable retries set MaximumAttempts to 1. The default RetryPolicy provided by the server can be overridden by the dynamic config.
$scheduleToCloseTimeout
The end to end timeout for the activity needed. The zero value of this uses default value.
public
DateInterval
$scheduleToCloseTimeout
Optional: The default value is the sum of $scheduleToStartTimeout and $startToCloseTimeout.
$scheduleToStartTimeout
The queue timeout before the activity starts executed.
public
DateInterval
$scheduleToStartTimeout
$startToCloseTimeout
The timeout from the start of execution to end of it.
public
DateInterval
$startToCloseTimeout
$taskQueue
TaskQueue that the activity needs to be scheduled on.
public
string|null
$taskQueue
= null
Optional: The default task queue with the same name as the workflow task queue.
Methods
__construct()
ActivityOptions constructor.
public
__construct() : mixed
mergeWith()
public
mergeWith([MethodRetry|null $retry = null ]) : $this
Parameters
- $retry : MethodRetry|null = null
Return values
$thiswithActivityId()
public
withActivityId(string $activityId) : $this
Parameters
- $activityId : string
Return values
$thiswithCancellationType()
public
withCancellationType(ActivityCancellationType|int $type) : $this
Parameters
- $type : ActivityCancellationType|int
Tags
Return values
$thiswithHeartbeatTimeout()
Heartbeat interval.
public
withHeartbeatTimeout(DateIntervalValue $timeout) : $this
Activity must heartbeat before this interval passes after a last heartbeat or activity start.
Parameters
- $timeout : DateIntervalValue
Tags
Return values
$thiswithRetryOptions()
public
withRetryOptions(RetryOptions|null $options) : $this
Parameters
- $options : RetryOptions|null
Return values
$thiswithScheduleToCloseTimeout()
Overall timeout workflow is willing to wait for activity to complete.
public
withScheduleToCloseTimeout(DateIntervalValue $timeout) : $this
It includes time in a task queue:
- Use ActivityOptions::withScheduleToStartTimeout($timeout) to limit it.
Plus activity execution time:
- Use ActivityOptions::withStartToCloseTimeout($timeout) to limit it.
Either this option or both schedule to start and start to close are required.
Parameters
- $timeout : DateIntervalValue
Tags
Return values
$thiswithScheduleToStartTimeout()
Time activity can stay in task queue before it is picked up by a worker.
public
withScheduleToStartTimeout(DateIntervalValue $timeout) : $this
If schedule to close is not provided then both this and start to close are required.
Parameters
- $timeout : DateIntervalValue
Tags
Return values
$thiswithStartToCloseTimeout()
Maximum activity execution time after it was sent to a worker.
public
withStartToCloseTimeout(DateIntervalValue $timeout) : $this
If schedule to close is not provided then both this and schedule to start are required.
Parameters
- $timeout : DateIntervalValue
Tags
Return values
$thiswithTaskQueue()
Task queue to use when dispatching activity task to a worker.
public
withTaskQueue(string|null $taskQueue) : $this
By default, it is the same task list name the workflow was started with.
Parameters
- $taskQueue : string|null