Documentation

RetryOptions extends Options
in package

Note that the history of activity with retry policy will be different:

The started event will be written down into history only when the activity completes or "finally" timeouts/fails. And the started event only records the last started time. Because of that, to check an activity has started or not, you cannot rely on history events. Instead, you can use CLI to describe the workflow to see the status of the activity: temporal --do wf desc -w

Tags
psalm-type

ExceptionsList = array<class-string<\Throwable>>

psalm-import-type

DateIntervalValue from DateInterval

psalm-immutable
see
RetryPolicy

Table of Contents

Constants

DEFAULT_BACKOFF_COEFFICIENT  = 2.0
DEFAULT_INITIAL_INTERVAL  = null
DEFAULT_MAXIMUM_ATTEMPTS  = 0
DEFAULT_MAXIMUM_INTERVAL  = null
DEFAULT_NON_RETRYABLE_EXCEPTIONS  = []

Properties

$backoffCoefficient  : float
Coefficient used to calculate the next retry backoff interval. The next retry interval is previous interval multiplied by this coefficient.
$initialInterval  : DateInterval|null
Backoff interval for the first retry. If {@see RetryOptions::$backoffCoefficient} is 1.0 then it is used for all retries.
$maximumAttempts  : int<0, max>
Maximum number of attempts. When exceeded the retries stop even if not expired yet. If not set or set to 0, it means unlimited, and rely on activity {@see ActivityOptions::$scheduleToCloseTimeout} to stop.
$maximumInterval  : DateInterval|null
Maximum backoff interval between retries. Exponential backoff leads to interval increase. This value is the cap of the interval.
$nonRetryableExceptions  : ExceptionsList
Non-Retriable errors. This is optional. Temporal server will stop retry if error type matches this list.

Methods

mergeWith()  : self
toWorkflowRetryPolicy()  : RetryPolicy
Converts DTO to protobuf object
withBackoffCoefficient()  : static
withInitialInterval()  : static
withMaximumAttempts()  : static
withMaximumInterval()  : static
withNonRetryableExceptions()  : static

Constants

DEFAULT_BACKOFF_COEFFICIENT

public float DEFAULT_BACKOFF_COEFFICIENT = 2.0

DEFAULT_INITIAL_INTERVAL

public null DEFAULT_INITIAL_INTERVAL = null

DEFAULT_MAXIMUM_ATTEMPTS

public int<0, max> DEFAULT_MAXIMUM_ATTEMPTS = 0

DEFAULT_MAXIMUM_INTERVAL

public null DEFAULT_MAXIMUM_INTERVAL = null

DEFAULT_NON_RETRYABLE_EXCEPTIONS

public mixed DEFAULT_NON_RETRYABLE_EXCEPTIONS = []
Tags
psalm-var

ExceptionsList

Properties

$backoffCoefficient

Coefficient used to calculate the next retry backoff interval. The next retry interval is previous interval multiplied by this coefficient.

public float $backoffCoefficient = self::DEFAULT_BACKOFF_COEFFICIENT

Note: Must be greater than 1.0

$initialInterval

Backoff interval for the first retry. If {@see RetryOptions::$backoffCoefficient} is 1.0 then it is used for all retries.

public DateInterval|null $initialInterval = self::DEFAULT_INITIAL_INTERVAL

$maximumAttempts

Maximum number of attempts. When exceeded the retries stop even if not expired yet. If not set or set to 0, it means unlimited, and rely on activity {@see ActivityOptions::$scheduleToCloseTimeout} to stop.

public int<0, max> $maximumAttempts = self::DEFAULT_MAXIMUM_ATTEMPTS

$maximumInterval

Maximum backoff interval between retries. Exponential backoff leads to interval increase. This value is the cap of the interval.

public DateInterval|null $maximumInterval = self::DEFAULT_MAXIMUM_INTERVAL

Default is 100x of $initialInterval.

$nonRetryableExceptions

Non-Retriable errors. This is optional. Temporal server will stop retry if error type matches this list.

public ExceptionsList $nonRetryableExceptions = self::DEFAULT_NON_RETRYABLE_EXCEPTIONS

Methods

toWorkflowRetryPolicy()

Converts DTO to protobuf object

public toWorkflowRetryPolicy() : RetryPolicy
Tags
psalm-suppress

ImpureMethodCall

Return values
RetryPolicy

withBackoffCoefficient()

public withBackoffCoefficient(float $coefficient) : static
Parameters
$coefficient : float
Tags
psalm-suppress

ImpureMethodCall

Return values
static

withInitialInterval()

public withInitialInterval(DateIntervalValue|null $interval) : static
Parameters
$interval : DateIntervalValue|null
Tags
psalm-suppress

ImpureMethodCall

Return values
static

withMaximumAttempts()

public withMaximumAttempts(int<0, max> $attempts) : static
Parameters
$attempts : int<0, max>
Tags
psalm-suppress

ImpureMethodCall

Return values
static

withMaximumInterval()

public withMaximumInterval(DateIntervalValue|null $interval) : static
Parameters
$interval : DateIntervalValue|null
Tags
psalm-suppress

ImpureMethodCall

Return values
static

withNonRetryableExceptions()

public withNonRetryableExceptions(ExceptionsList $exceptions) : static
Parameters
$exceptions : ExceptionsList
Tags
psalm-suppress

ImpureMethodCall

Return values
static

        
On this page

Search results