Search⌘ K
AI Features

Queue Jobs Directly

Explore how to effectively invoke background jobs in Ruby on Rails by using your chosen job backend’s API directly. Learn why avoiding Active Job abstraction can simplify argument handling and improve performance. Practice queuing jobs with basic arguments like database IDs to ensure reliable job execution.

Once we know how our job backend works and when to use a background job, how do we write one and how do we invoke it? Let’s talk about invocation first.

Using Active Job for backend

Active Job was added to Rails in recent years as a single abstraction over background jobs. This provides a way for library authors to interact with background jobs without having to know about the underlying backend.

Active Job does a great job at this, but because we aren’t writing library code, it creates some complexities that won’t provide much value in return. Because Active Job ...