Active Job as a universal queue interface
In Chapter 1, Rails as a Web Application Framework, we talked about the background jobs layer and its importance for Rails applications. Before Rails 4.2, we only had implementation-specific mechanisms to build this layer: Sidekiq workers, delayed method calls (via the delayed_job
gem), and so on.
The more implementations, the more code styles and patterns are in use; hence, the higher the learning curve for a new developer joining a Rails project. Rails’ omakase was incomplete—no item from the Background processing category was on the menu.
What is omakase?
Omakase is a Japanese term used to describe a meal consisting of dishes selected by the chef. Rails is omakase means that the framework maintainers have chosen the building blocks for your application, and they play together nicely.
To solve these problems, the Active Job framework was introduced in Rails 4.2. What is Active Job? Let’s consider a minimal...