Skip to main content

Class: BuildIdAssignmentRule

taskqueue.v1.BuildIdAssignmentRule

Assignment rules are applied to new Workflow and Activity executions at schedule time to assign them to a Build ID.

Assignment rules will not be used in the following cases:

  • Child Workflows or Continue-As-New Executions who inherit their parent/previous Workflow's assigned Build ID (by setting the inherit_build_id flag - default behavior in SDKs when the same Task Queue is used.)
  • An Activity that inherits the assigned Build ID of its Workflow (by setting the use_workflow_build_id flag - default behavior in SDKs when the same Task Queue is used.)

In absence of (applicable) redirect rules (CompatibleBuildIdRedirectRules) the task will be dispatched to Workers of the Build ID determined by the assignment rules (or inherited). Otherwise, the final Build ID will be determined by the redirect rules.

Once a Workflow completes its first Workflow Task in a particular Build ID it stays in that Build ID regardless of changes to assignment rules. Redirect rules can be used to move the workflow to another compatible Build ID.

When using Worker Versioning on a Task Queue, in the steady state, there should typically be a single assignment rule to send all new executions to the latest Build ID. Existence of at least one such "unconditional" rule at all times is enforces by the system, unless the force flag is used by the user when replacing/deleting these rules (for exceptional cases).

During a deployment, one or more additional rules can be added to assign a subset of the tasks to a new Build ID based on a "ramp percentage".

When there are multiple assignment rules for a Task Queue, the rules are evaluated in order, starting from index 0. The first applicable rule will be applied and the rest will be ignored.

In the event that no assignment rule is applicable on a task (or the Task Queue is simply not versioned), the tasks will be dispatched to an unversioned Worker.

Implements

Constructors

constructor

new BuildIdAssignmentRule(properties?): BuildIdAssignmentRule

Constructs a new BuildIdAssignmentRule.

Parameters

NameTypeDescription
properties?IBuildIdAssignmentRuleProperties to set

Returns

BuildIdAssignmentRule

Properties

percentageRamp

Optional percentageRamp: null | IRampByPercentage

This ramp is useful for gradual Blue/Green deployments (and similar) where you want to send a certain portion of the traffic to the target Build ID.

Implementation of

IBuildIdAssignmentRule.percentageRamp


ramp

Optional ramp: "percentageRamp"

If a ramp is provided, this rule will be applied only to a sample of tasks according to the provided percentage. This option can be used only on "terminal" Build IDs (the ones not used as source in any redirect rules).


targetBuildId

targetBuildId: string

BuildIdAssignmentRule targetBuildId.

Implementation of

IBuildIdAssignmentRule.targetBuildId

Methods

toJSON

toJSON(): Object

Converts this BuildIdAssignmentRule to JSON.

Returns

Object

JSON object


create

create(properties?): BuildIdAssignmentRule

Creates a new BuildIdAssignmentRule instance using the specified properties.

Parameters

NameTypeDescription
properties?IBuildIdAssignmentRuleProperties to set

Returns

BuildIdAssignmentRule

BuildIdAssignmentRule instance


decode

decode(reader, length?): BuildIdAssignmentRule

Decodes a BuildIdAssignmentRule message from the specified reader or buffer.

Parameters

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

Returns

BuildIdAssignmentRule

BuildIdAssignmentRule

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): BuildIdAssignmentRule

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

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

BuildIdAssignmentRule

BuildIdAssignmentRule

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 BuildIdAssignmentRule message. Does not implicitly temporal.api.taskqueue.v1.BuildIdAssignmentRule.verify|verify messages.

Parameters

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

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

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

Parameters

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

Returns

Writer

Writer


fromObject

fromObject(object): BuildIdAssignmentRule

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

Parameters

NameTypeDescription
objectObjectPlain object

Returns

BuildIdAssignmentRule

BuildIdAssignmentRule


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for BuildIdAssignmentRule

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 BuildIdAssignmentRule message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageBuildIdAssignmentRuleBuildIdAssignmentRule
options?IConversionOptionsConversion options

Returns

Object

Plain object