Module: TenantKit::Job
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/tenant_kit/job.rb
Overview
Mixed into ActiveJob::Base (via the railtie, when
config.propagate_to_jobs is true) so a job runs under the same tenant it
was enqueued under — even though it executes later, in another process, with
no request context.
The tenant's GlobalID is captured at enqueue time and folded into the job's
serialized payload (not just an in-memory attribute), so it survives any
ActiveJob queue adapter — Solid Queue included — and is re-established around
perform.
Instance Method Summary collapse
-
#deserialize(job_data) ⇒ void
Restores the captured tenant GlobalID when the job is deserialized for execution.
-
#serialize ⇒ Hash
Folds the captured tenant GlobalID into the serialized job payload so it round-trips through the queue adapter.
Instance Method Details
#deserialize(job_data) ⇒ void
This method returns an undefined value.
Restores the captured tenant GlobalID when the job is deserialized for execution.
50 51 52 53 |
# File 'lib/tenant_kit/job.rb', line 50 def deserialize(job_data) super self.tenant_kit_gid = job_data["tenant_kit_gid"] end |
#serialize ⇒ Hash
Folds the captured tenant GlobalID into the serialized job payload so it round-trips through the queue adapter.
41 42 43 |
# File 'lib/tenant_kit/job.rb', line 41 def serialize super.merge("tenant_kit_gid" => tenant_kit_gid) end |