Module: Zeridion::Flare::Job::ClassMacros
- Defined in:
- lib/zeridion_flare/worker/job.rb
Overview
flare_options ... and the resolved config readers, mixed into the
including class as class methods.
Instance Method Summary collapse
- #flare_job_type ⇒ Object
- #flare_max_attempts ⇒ Object
-
#flare_options(job_type: nil, queue: nil, max_attempts: nil, timeout: nil, payload_struct: nil) ⇒ Object
Set per-class defaults.
- #flare_payload_struct ⇒ Object
- #flare_queue ⇒ Object
- #flare_timeout ⇒ Object
Instance Method Details
#flare_job_type ⇒ Object
55 56 57 58 |
# File 'lib/zeridion_flare/worker/job.rb', line 55 def flare_job_type @flare_job_type || name || raise(ArgumentError, "anonymous job class needs an explicit flare_options(job_type:)") end |
#flare_max_attempts ⇒ Object
64 65 66 |
# File 'lib/zeridion_flare/worker/job.rb', line 64 def flare_max_attempts @flare_max_attempts || 3 end |
#flare_options(job_type: nil, queue: nil, max_attempts: nil, timeout: nil, payload_struct: nil) ⇒ Object
Set per-class defaults. All keys optional.
46 47 48 49 50 51 52 53 |
# File 'lib/zeridion_flare/worker/job.rb', line 46 def (job_type: nil, queue: nil, max_attempts: nil, timeout: nil, payload_struct: nil) @flare_job_type = job_type unless job_type.nil? @flare_queue = queue unless queue.nil? @flare_max_attempts = max_attempts unless max_attempts.nil? @flare_timeout = timeout unless timeout.nil? @flare_payload_struct = payload_struct unless payload_struct.nil? nil end |
#flare_payload_struct ⇒ Object
72 73 74 |
# File 'lib/zeridion_flare/worker/job.rb', line 72 def flare_payload_struct @flare_payload_struct end |
#flare_queue ⇒ Object
60 61 62 |
# File 'lib/zeridion_flare/worker/job.rb', line 60 def flare_queue @flare_queue || "default" end |
#flare_timeout ⇒ Object
68 69 70 |
# File 'lib/zeridion_flare/worker/job.rb', line 68 def flare_timeout @flare_timeout || 1800 end |