Skip to main content

Class: Priority

common.v1.Priority

Priority contains metadata that controls relative ordering of task processing when tasks are backlogged in a queue. Initially, Priority will be used in activity and workflow task queues, which are typically where backlogs exist. Other queues in the server (such as transfer and timer queues) and rate limiting decisions do not use Priority, but may in the future.

Priority is attached to workflows and activities. Activities and child workflows inherit Priority from the workflow that created them, but may override fields when they are started or modified. For each field of a Priority on an activity/workflow, 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 (documented below).

Despite being named "Priority", this message will also contains fields that control "fairness" mechanisms.

The overall semantics of Priority are:

  1. First, consider "priority_key": lower number goes first. (more will be added here later)

Implements

Constructors

constructor

new Priority(properties?): Priority

Constructs a new Priority.

Parameters

NameTypeDescription
properties?IPriorityProperties to set

Returns

Priority

Properties

priorityKey

priorityKey: number

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.

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

The default priority is (min+max)/2. With the default max of 5 and min of 1, that comes out to 3.

Implementation of

IPriority.priorityKey

Methods

toJSON

toJSON(): Object

Converts this Priority to JSON.

Returns

Object

JSON object


create

create(properties?): Priority

Creates a new Priority instance using the specified properties.

Parameters

NameTypeDescription
properties?IPriorityProperties to set

Returns

Priority

Priority instance


decode

decode(reader, length?): Priority

Decodes a Priority message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

Priority

Priority

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Priority

Decodes a Priority message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

Priority

Priority

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified Priority message. Does not implicitly temporal.api.common.v1.Priority.verify|verify messages.

Parameters

NameTypeDescription
messageIPriorityPriority message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified Priority message, length delimited. Does not implicitly temporal.api.common.v1.Priority.verify|verify messages.

Parameters

NameTypeDescription
messageIPriorityPriority message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): Priority

Creates a Priority message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

Priority

Priority


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for Priority

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toObject

toObject(message, options?): Object

Creates a plain object from a Priority message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messagePriorityPriority
options?IConversionOptionsConversion options

Returns

Object

Plain object