Table of Contents

Class BuildIdAssignmentRule

Namespace
Temporalio.Api.TaskQueue.V1
Assembly
Temporalio.dll

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.

public sealed class BuildIdAssignmentRule : IMessage<BuildIdAssignmentRule>, IEquatable<BuildIdAssignmentRule>, IDeepCloneable<BuildIdAssignmentRule>, IBufferMessage, IMessage
Inheritance
BuildIdAssignmentRule
Implements
IDeepCloneable<BuildIdAssignmentRule>
IBufferMessage
IMessage
Inherited Members

Constructors

BuildIdAssignmentRule()

public BuildIdAssignmentRule()

BuildIdAssignmentRule(BuildIdAssignmentRule)

public BuildIdAssignmentRule(BuildIdAssignmentRule other)

Parameters

other BuildIdAssignmentRule

Fields

PercentageRampFieldNumber

Field number for the "percentage_ramp" field.

public const int PercentageRampFieldNumber = 3

Field Value

int

TargetBuildIdFieldNumber

Field number for the "target_build_id" field.

public const int TargetBuildIdFieldNumber = 1

Field Value

int

Properties

Descriptor

public static MessageDescriptor Descriptor { get; }

Property Value

MessageDescriptor

Parser

public static MessageParser<BuildIdAssignmentRule> Parser { get; }

Property Value

MessageParser<BuildIdAssignmentRule>

PercentageRamp

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.

public RampByPercentage PercentageRamp { get; set; }

Property Value

RampByPercentage

RampCase

public BuildIdAssignmentRule.RampOneofCase RampCase { get; }

Property Value

BuildIdAssignmentRule.RampOneofCase

TargetBuildId

public string TargetBuildId { get; set; }

Property Value

string

Methods

CalculateSize()

Calculates the size of this message in Protocol Buffer wire format, in bytes.

public int CalculateSize()

Returns

int

The number of bytes required to write this message to a coded output stream.

ClearRamp()

public void ClearRamp()

Clone()

Creates a deep clone of this object.

public BuildIdAssignmentRule Clone()

Returns

BuildIdAssignmentRule

A deep clone of this object.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object other)

Parameters

other object

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(BuildIdAssignmentRule)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(BuildIdAssignmentRule other)

Parameters

other BuildIdAssignmentRule

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

MergeFrom(CodedInputStream)

Merges the data from the specified coded input stream with the current message.

public void MergeFrom(CodedInputStream input)

Parameters

input CodedInputStream

Remarks

See the user guide for precise merge semantics.

MergeFrom(BuildIdAssignmentRule)

Merges the given message into this one.

public void MergeFrom(BuildIdAssignmentRule other)

Parameters

other BuildIdAssignmentRule

Remarks

See the user guide for precise merge semantics.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

WriteTo(CodedOutputStream)

Writes the data to the given coded output stream.

public void WriteTo(CodedOutputStream output)

Parameters

output CodedOutputStream

Coded output stream to write the data to. Must not be null.