Class: Temporalio::Priority

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/priority.rb,
lib/temporalio/priority.rb

Overview

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. Priority is (for now) 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 on the field).

The overall semantics of Priority are:

  1. First, consider “priority_key”: lower number goes first.

(more will be added here later).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(priority_key: nil, fairness_key: nil, fairness_weight: nil) ⇒ Priority

Initialize a new Priority instance.



80
81
82
# File 'lib/temporalio/priority.rb', line 80

def initialize(priority_key: nil, fairness_key: nil, fairness_weight: nil)
  super
end

Instance Attribute Details

#fairness_keyString?



56
57
58
# File 'lib/temporalio/priority.rb', line 56

def fairness_key
  @fairness_key
end

#fairness_weightFloat?



56
57
58
# File 'lib/temporalio/priority.rb', line 56

def fairness_weight
  @fairness_weight
end

#priority_keyInteger?



56
57
58
# File 'lib/temporalio/priority.rb', line 56

def priority_key
  @priority_key
end

Class Method Details

.defaultPriority

The default priority instance.



71
72
73
# File 'lib/temporalio/priority.rb', line 71

def self.default
  @default ||= new(priority_key: nil, fairness_key: nil, fairness_weight: nil)
end

Instance Method Details

#empty?Boolean



96
97
98
# File 'lib/temporalio/priority.rb', line 96

def empty?
  priority_key.nil? && fairness_key.nil? && fairness_weight.nil?
end