Documentation

MethodRetry extends RetryOptions
in package

FinalYes

Specifies a retry policy for a workflow or activity method. This annotation applies only to activity or workflow interface methods. For workflows currently used only for child workflow retries. Not required. When not used either retries don't happen or they are configured through correspondent options. If {@see RetryOptions} are present on {@see ActivityOptions} or {@see ChildWorkflowOptions} the fields that are not default take precedence over parameters of this attribute/annotation.

Tags
psalm-import-type

DateIntervalValue from DateInterval

psalm-import-type

ExceptionsList from RetryOptions

Annotation
NamedArgumentConstructor
Target

({ "METHOD" })

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

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

Attributes

#[Attribute]

#[Attribute]

#[NamedArgumentConstructor]

#[NamedArgumentConstructor]

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

__construct()

public __construct([DateIntervalValue|null $initialInterval = self::DEFAULT_INITIAL_INTERVAL ][, DateIntervalValue|null $maximumInterval = self::DEFAULT_MAXIMUM_INTERVAL ][, int<0, max> $maximumAttempts = self::DEFAULT_MAXIMUM_ATTEMPTS ][, float $backoffCoefficient = self::DEFAULT_BACKOFF_COEFFICIENT ][, ExceptionsList $nonRetryableExceptions = self::DEFAULT_NON_RETRYABLE_EXCEPTIONS ]) : mixed
Parameters
$initialInterval : DateIntervalValue|null = self::DEFAULT_INITIAL_INTERVAL
$maximumInterval : DateIntervalValue|null = self::DEFAULT_MAXIMUM_INTERVAL
$maximumAttempts : int<0, max> = self::DEFAULT_MAXIMUM_ATTEMPTS
$backoffCoefficient : float = self::DEFAULT_BACKOFF_COEFFICIENT
$nonRetryableExceptions : ExceptionsList = self::DEFAULT_NON_RETRYABLE_EXCEPTIONS

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