Class: Zizq::Resources::JobTemplate
- Defined in:
- lib/zizq/resources/job_template.rb
Overview
Typed wrapper around a job template — the fields shared between live jobs and cron entry job definitions.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#backoff ⇒ Object
Backoff configuration converted from the wire format (ms) to the Ruby-idiomatic format (seconds), matching the Zizq::backoff type.
-
#payload ⇒ Object
: () -> Hash[String, untyped]?.
-
#priority ⇒ Object
: () -> Integer?.
-
#queue ⇒ Object
: () -> String.
-
#retention ⇒ Object
Retention configuration converted from the wire format (ms) to the Ruby-idiomatic format (seconds), matching the Zizq::retention type.
-
#retry_limit ⇒ Object
: () -> Integer?.
-
#type ⇒ Object
: () -> String.
-
#unique_key ⇒ Object
: () -> String?.
-
#unique_while ⇒ Object
: () -> Zizq::unique_scope?.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Zizq::Resources::Resource
Instance Method Details
#backoff ⇒ Object
Backoff configuration converted from the wire format (ms) to the Ruby-idiomatic format (seconds), matching the Zizq::backoff type.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zizq/resources/job_template.rb', line 22 def backoff #: () -> Zizq::backoff? raw = @data["backoff"] return nil unless raw { exponent: raw["exponent"].to_f, base: raw["base_ms"] / 1000.0, jitter: raw["jitter_ms"] / 1000.0 } end |
#payload ⇒ Object
: () -> Hash[String, untyped]?
15 |
# File 'lib/zizq/resources/job_template.rb', line 15 def payload = @data["payload"] #: () -> Hash[String, untyped]? |
#priority ⇒ Object
: () -> Integer?
14 |
# File 'lib/zizq/resources/job_template.rb', line 14 def priority = @data["priority"] #: () -> Integer? |
#queue ⇒ Object
: () -> String
13 |
# File 'lib/zizq/resources/job_template.rb', line 13 def queue = @data["queue"] #: () -> String |
#retention ⇒ Object
Retention configuration converted from the wire format (ms) to the Ruby-idiomatic format (seconds), matching the Zizq::retention type.
35 36 37 38 39 40 41 42 43 |
# File 'lib/zizq/resources/job_template.rb', line 35 def retention #: () -> Zizq::retention? raw = @data["retention"] return nil unless raw result = {} #: Hash[Symbol, Float] result[:completed] = raw["completed_ms"] / 1000.0 if raw["completed_ms"] result[:dead] = raw["dead_ms"] / 1000.0 if raw["dead_ms"] result end |
#retry_limit ⇒ Object
: () -> Integer?
16 |
# File 'lib/zizq/resources/job_template.rb', line 16 def retry_limit = @data["retry_limit"] #: () -> Integer? |
#type ⇒ Object
: () -> String
12 |
# File 'lib/zizq/resources/job_template.rb', line 12 def type = @data["type"] #: () -> String |
#unique_key ⇒ Object
: () -> String?
17 |
# File 'lib/zizq/resources/job_template.rb', line 17 def unique_key = @data["unique_key"] #: () -> String? |
#unique_while ⇒ Object
: () -> Zizq::unique_scope?
18 |
# File 'lib/zizq/resources/job_template.rb', line 18 def unique_while = @data["unique_while"]&.to_sym #: () -> Zizq::unique_scope? |