Mid-level Track Roadmap

Background jobs: ActiveJob

This course looks at ActiveJob::Base, the framework layer this app's jobs are written against, above whichever backend runs them. It covers how the queue adapter changes per environment, how arguments are serialised as GlobalIDs or plain ids, and when retry_on and discard_on have an exception to catch. It also covers how limits_concurrency and queue_as map onto Solid Queue's tables, the perform callbacks, and how deliver_later enqueues an ActionMailer job through the same adapter.

What you'll learn

  • ✓How queue_adapter runs the same job on :async in development and :solid_queue in test and production
  • ✓How ActiveJob serialises a record as a GlobalID, and why the app passes a plain id with find_by
  • ✓When retry_on and discard_on apply, based on whether an exception reaches perform
  • ✓How limits_concurrency writes a concurrency_key and sends a second job to blocked executions
  • ✓How queue_as, queue_with_priority and config/queue.yml decide which worker claims a job
  • ✓How deliver_later enqueues ActionMailer::MailDeliveryJob, and where perform callbacks fit
Free preview · Lesson 1 3 min read

The framework layer above the backend

The mid-level course "Solid Queue: job architecture", earlier in this series, looked at the tables where a job's state is stored and claimed. Every one of those tables belongs to Solid Queue, one backend. This app's jobs are never written against Solid Queue directly. They're written against…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...