Class Priority.Builder

java.lang.Object
io.temporal.common.Priority.Builder
Enclosing class:
Priority

public static final class Priority.Builder extends Object
  • Method Details

    • setPriorityKey

      public Priority.Builder setPriorityKey(int 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.

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

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

    • setFairnessKey

      public Priority.Builder setFairnessKey(String 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.

      >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.

    • setFairnessWeight

      public Priority.Builder setFairnessWeight(float fairnessWeight)
      FairnessWeight for a task can come from multiple sources for flexibility. From highest to lowest precedence:
      • Weights for a small set of keys can be overridden in task queue configuration with an API.
      • It can be attached to the workflow/activity in this field.
      • The default weight of 1.0 will be used.

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

    • build

      public Priority build()