Module: Karafka::ActiveJob::CurrentAttributes::Persistence
- Defined in:
- lib/karafka/active_job/current_attributes/persistence.rb
Overview
Module adding the current attributes persistence into the ActiveJob jobs
Instance Method Summary collapse
-
#serialize_job(job) ⇒ Object
Alters the job serialization to inject the current attributes into the json before we send it to Kafka.
Instance Method Details
#serialize_job(job) ⇒ Object
Alters the job serialization to inject the current attributes into the json before we send it to Kafka
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/karafka/active_job/current_attributes/persistence.rb', line 12 def serialize_job(job) json = super(job) _cattr_klasses.each do |key, cattr_klass_str| next if json.key?(key) attrs = cattr_klass_str.constantize.attributes json[key] = attrs unless attrs.empty? end json end |