In a Rails application, you configure config.active_job.queue_adapter = :sidekiq. What does this setting do?
Think about what Active Job does and how it connects to background job processors.
Setting config.active_job.queue_adapter = :sidekiq tells Rails to use Sidekiq as the backend to run jobs queued through Active Job. This means jobs are processed asynchronously by Sidekiq workers.
Choose the correct code snippet to set Sidekiq as the Active Job queue adapter in config/application.rb or an initializer.
Remember the correct way to access Rails configuration in config/application.rb.
The correct syntax is Rails.application.config.active_job.queue_adapter = :sidekiq. It uses the symbol :sidekiq and accesses the config through Rails.application.config.
Given config.active_job.queue_adapter = :sidekiq, what is the behavior when you call MyJob.perform_later(args)?
class MyJob < ApplicationJob def perform(name) puts "Hello, #{name}!" end end MyJob.perform_later('Alice')
Think about how Sidekiq processes jobs and what perform_later does.
With Sidekiq as the adapter, perform_later enqueues the job into Sidekiq's Redis queue. Sidekiq workers then process the job asynchronously in the background.
After setting config.active_job.queue_adapter = :sidekiq, you enqueue a job but it never runs. What is the most likely cause?
class NotifyUserJob < ApplicationJob def perform(user_id) # send notification end end NotifyUserJob.perform_later(1)
Check if the background worker process is active.
Setting the adapter only configures Rails to enqueue jobs to Sidekiq. Sidekiq must be running as a separate process to pull jobs from Redis and execute them. If Sidekiq is not running, jobs stay queued and never run.
Order the steps from job enqueue to job execution when using Sidekiq as the Active Job adapter.
Think about what happens first: enqueue, serialize, fetch, then execute.
First, Active Job calls perform_later (1). Then the Sidekiq adapter serializes the job and pushes it to Redis (3). Sidekiq workers fetch the job from Redis (2) and finally execute the job's perform method (4).