Organizing Sidekiq Job Code
Other than keeping the code in your jobs to a minimum (as discussed in Create a New Sidekiq Job), the main issue with organizing Sidekiq job code is managing duplication. There are three ways to do so: using middleware, using generators, and using a common base class. Using a base class should be familiar to you, since that is how most code is shared in Rails codebase. One problem with our Sidekiq jobs is that ApplicationJob is using Active Job.
No Need for Active Job
Active Job is a generalized interface for queuing jobs,[24] that can use any job library underneath, be it Sidekiq, Resque, or something else. This is useful when an external library or Rails’ internals need to queue a job. This is less useful when ...
Get Ruby on Rails Background Jobs with Sidekiq now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.