Class: ActiveJob::Base
- Defined in:
- runtime/active_job/base.rb,
runtime/active_job/base.rbs
Overview
The job class contract — the members every dispatch path reads: recurring
calls job_name to key the registration, the adapter's handler catalog is
keyed by the same name, and the body runs as job_class.perform(data) — a
class method; this runtime never instantiates a job. data is the decoded
payload (nil when none). The base implements job_name (the class name);
the bodies stay raising specs (the Sqlx::Base pattern) — a job that forgot
a body fails loud with the contract named, wherever it was driven from.
Direct Known Subclasses
ActionMailer::DeliveryJob, Snails::LogDeliveryJob, Snails::QueuePruneJob
Class Method Summary collapse
-
.job_name ⇒ String
the key the job registers and is dispatched under: the recurring beat's name, the adapter's handler catalog entry, and the name a store-backed drain resolves back to the class all use it.
-
.perform(data) ⇒ void
the job body, a class method: every runtime-driven path calls it with one argument —
datais the decoded payload, nil for a payload-less job — so one call shape covers both (recurring's beat,enqueue, a store-backed drain); a job that takes no arguments still declares the parameter and ignores it.
Class Method Details
.job_name ⇒ String
the key the job registers and is dispatched under: the recurring beat's
name, the adapter's handler catalog entry, and the name a store-backed
drain resolves back to the class all use it. The base derives it from the
class name (name); a job overrides this method when the key must differ
— for cross-process dispatch the key must stay a constant path
(Object.const_get resolves it on the store-backed drain).
238 |
# File 'runtime/active_job/base.rb', line 238
def self.job_name: () -> String
|
.perform(data) ⇒ void
the job body, a class method: every runtime-driven path calls it with one
argument — data is the decoded payload, nil for a payload-less job — so
one call shape covers both (recurring's beat, enqueue, a store-backed
drain); a job that takes no arguments still declares the parameter and
ignores it. The runtime never instantiates a job. The base raises so a job
that forgot the body fails loud with the contract named instead of a bare
NoMethodError at its first fire.
258 |
# File 'runtime/active_job/base.rb', line 258
def self.perform: (untyped? data) -> void
|