Recall & Review
beginner
What is a job queue in Rails Active Job?
A job queue is a list where background jobs wait to be processed. Rails Active Job lets you put tasks like sending emails or processing images into queues to run later without blocking the main app.
Click to reveal answer
intermediate
How do you assign a priority to a job in Rails?
You assign a priority by choosing or creating different queues with names that imply priority, like 'high_priority' or 'low_priority'. Jobs in higher priority queues get processed before others.
Click to reveal answer
intermediate
What is the role of a queue adapter in Rails Active Job?
A queue adapter connects Rails Active Job to the backend system that actually runs the jobs, like Sidekiq or Resque. It manages how jobs are pushed to and pulled from queues.
Click to reveal answer
beginner
How can you specify which queue a job should use in Rails?
Inside your job class, you use the `queue_as` method to name the queue. For example, `queue_as :mailers` sends the job to the 'mailers' queue.
Click to reveal answer
intermediate
Why use multiple queues with different priorities in a Rails app?
Using multiple queues lets you control which jobs run first. Important tasks like sending notifications can go to a high-priority queue, so they run faster, while less urgent jobs wait in lower-priority queues.
Click to reveal answer
In Rails Active Job, how do you set a job to run in a specific queue?
✗ Incorrect
You specify the queue inside the job class using `queue_as :queue_name`.
What does a queue adapter do in Rails Active Job?
✗ Incorrect
The queue adapter links Active Job to the system like Sidekiq that processes jobs.
Why might you use multiple queues with different priorities?
✗ Incorrect
Multiple queues let you prioritize important jobs to run before less important ones.
Which of these is NOT a common queue adapter in Rails?
✗ Incorrect
Webpacker is for managing JavaScript assets, not job queues.
What happens if you don't specify a queue for a job in Rails Active Job?
✗ Incorrect
Jobs without a specified queue go to the default queue.
Explain how job priorities and queues work in Rails Active Job and why they are useful.
Think about how you organize tasks by importance in real life.
You got /4 concepts.
Describe the role of a queue adapter in Rails and name some common adapters.
Adapters connect Rails to the system that runs jobs.
You got /2 concepts.