@@ -60,23 +60,34 @@ public Builder setPriorityKey(int priorityKey) {
6060 }
6161
6262 /**
63- * A fairness key is a short string used for balancing task dispatch. Tasks with the same
64- * fairness key will be processed proportionally according to their fairness weight.
63+ * FairnessKey is a short string that's used as a key for a fairness balancing mechanism. It may
64+ * correspond to a tenant id, or to a fixed string like "high" or "low". The default is the
65+ * empty string.
6566 *
66- * <p>If not set, inherits from the parent workflow or uses an empty string if there is no
67- * parent.
67+ * <p>>The fairness mechanism attempts to dispatch tasks for a given key in proportion to its
68+ * weight. For example, using a thousand distinct tenant ids, each with a weight of 1.0 (the
69+ * default) will result in each tenant getting a roughly equal share of task dispatch
70+ * throughput.
71+ *
72+ * <p>Fairness keys are limited to 64 bytes.
6873 */
6974 public Builder setFairnessKey (String fairnessKey ) {
7075 this .fairnessKey = fairnessKey ;
7176 return this ;
7277 }
7378
7479 /**
75- * A fairness weight determines the relative proportion of task processing for a given fairness
76- * key. The weight should be a positive number. A higher weight means more tasks will be
77- * processed for that fairness key.
80+ * FairnessWeight for a task can come from multiple sources for flexibility. From highest to
81+ * lowest precedence:
82+ *
83+ * <ul>
84+ * <li>Weights for a small set of keys can be overridden in task queue configuration with an
85+ * API.
86+ * <li>It can be attached to the workflow/activity in this field.
87+ * <li>The default weight of 1.0 will be used.
88+ * </ul>
7889 *
79- * <p>If not set or 0, defaults to 1.0. If there is a parent workflow, inherits from the parent .
90+ * <p>Weight values are clamped to the range [0.001, 1000] .
8091 */
8192 public Builder setFairnessWeight (float fairnessWeight ) {
8293 this .fairnessWeight = fairnessWeight ;
0 commit comments