Module: Karafka::ActiveJob::JobExtensions
- Defined in:
- lib/karafka/active_job/job_extensions.rb
Overview
Allows for setting karafka specific options in ActiveJob jobs
Class Method Summary collapse
-
.extended(klass) ⇒ Object
Defines all the needed accessors and sets defaults.
Instance Method Summary collapse
-
#karafka_options(new_options = {}) ⇒ Hash
Karafka options.
Class Method Details
.extended(klass) ⇒ Object
Defines all the needed accessors and sets defaults
10 11 12 13 |
# File 'lib/karafka/active_job/job_extensions.rb', line 10 def extended(klass) klass.class_attribute :_karafka_options klass. = {} end |
Instance Method Details
#karafka_options(new_options = {}) ⇒ Hash
Returns karafka options.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/karafka/active_job/job_extensions.rb', line 19 def ( = {}) return if .empty? # Make sure, that karafka options that someone wants to use are valid before assigning # them App.config.internal.active_job..validate!() # We need to modify this hash because otherwise we would modify parent hash. self. = .dup .each do |name, value| [name] = value end end |