Temporal Docs PHP SDK API Version 2.20 (latest release) Release notes

Documentation

Priority
in package

FinalYes

Priority contains metadata that controls the relative ordering of task processing when tasks are backed up in a queue. The affected queues depend on the server version.

Priority is attached to workflows and activities. By default, activities and child workflows inherit Priority from the workflow that created them, but may override fields when an activity is started or modified.

For all fields, the field not present or equal to zero/empty string means to inherit the value from the calling workflow, or if there is no calling workflow, then use the default value.

Tags
see
Priority

Table of Contents

Properties

$fairnessKey  : string
FairnessKey is a short string that's used as a key for a fairness balancing mechanism. It may correspond to a tenant id, or to a fixed string like "high" or "low". The default is the empty string.
$fairnessWeight  : float
FairnessWeight for a task can come from multiple sources for flexibility. From highest to lowest precedence: 1. Weights for a small set of keys can be overridden in task queue configuration with an API.
$priorityKey  : int<0, max>
A priority key is a positive integer from 1 to n, where smaller integers correspond to higher priorities (tasks run sooner). In general, tasks in a queue should be processed in close to priority order, although small deviations are possible.

Methods

new()  : self
Create a new Priority instance.
withFairnessKey()  : $this
FairnessKey is a short string that's used as a key for a fairness balancing mechanism. It may correspond to a tenant id, or to a fixed string like "high" or "low". The default is the empty string.
withFairnessWeight()  : $this
FairnessWeight for a task can come from multiple sources for flexibility. From highest to lowest precedence: 1. Weights for a small set of keys can be overridden in task queue configuration with an API.
withPriorityKey()  : $this
A priority key is a positive integer from 1 to n, where smaller integers correspond to higher priorities (tasks run sooner). In general, tasks in a queue should be processed in close to priority order, although small deviations are possible.
__construct()  : mixed

Properties

$fairnessKey

FairnessKey is a short string that's used as a key for a fairness balancing mechanism. It may correspond to a tenant id, or to a fixed string like "high" or "low". The default is the empty string.

public string $fairnessKey = ''

The fairness mechanism attempts to dispatch tasks for a given key in proportion to its weight. For example, using a thousand distinct tenant ids, each with a weight of 1.0 (the default) will result in each tenant getting a roughly equal share of task dispatch throughput.

Fairness keys are limited to 64 bytes.

Attributes
#[Marshal]
$name: 'fairness_key'
#[Marshal]
$name: 'FairnessKey'

$fairnessWeight

FairnessWeight for a task can come from multiple sources for flexibility. From highest to lowest precedence: 1. Weights for a small set of keys can be overridden in task queue configuration with an API.

public float $fairnessWeight = 0.0
  1. It can be attached to the workflow/activity in this field.
  2. The default weight of 1.0 will be used.

Weight values are clamped to the range [0.001, 1000].

Attributes
#[Marshal]
$name: 'fairness_weight'
#[Marshal]
$name: 'FairnessWeight'

$priorityKey

A priority key is a positive integer from 1 to n, where smaller integers correspond to higher priorities (tasks run sooner). In general, tasks in a queue should be processed in close to priority order, although small deviations are possible.

public int<0, max> $priorityKey = 0

The maximum priority value (minimum priority) is determined by server configuration, and defaults to 5.

The default value when 0 is calculated by (min+max)/2. With the default max of 5, and min of 1, that comes out to 3.

Attributes
#[Marshal]
$name: 'priority_key'
#[Marshal]
$name: 'PriorityKey'

Methods

new()

Create a new Priority instance.

public static new([int $priorityKey = 0 ]) : self
Parameters
$priorityKey : int = 0
Return values
self

withFairnessKey()

FairnessKey is a short string that's used as a key for a fairness balancing mechanism. It may correspond to a tenant id, or to a fixed string like "high" or "low". The default is the empty string.

public withFairnessKey(string $value) : $this
Parameters
$value : string
Return values
$this

withFairnessWeight()

FairnessWeight for a task can come from multiple sources for flexibility. From highest to lowest precedence: 1. Weights for a small set of keys can be overridden in task queue configuration with an API.

public withFairnessWeight(float $value) : $this
  1. It can be attached to the workflow/activity in this field.
  2. The default weight of 1.0 will be used.

Weight values are clamped to the range [0.001, 1000].

Parameters
$value : float
Return values
$this

withPriorityKey()

A priority key is a positive integer from 1 to n, where smaller integers correspond to higher priorities (tasks run sooner). In general, tasks in a queue should be processed in close to priority order, although small deviations are possible.

public withPriorityKey(int<0, max> $value) : $this
Parameters
$value : int<0, max>
Return values
$this

__construct()

private __construct([int<0, max> $priorityKey = 0 ]) : mixed
Parameters
$priorityKey : int<0, max> = 0
On this page

Search results