module MsgQueue class UserActivationConfirm < Struct.new(:user_id) def perform user = User.find(user_id) user.activation_confirmation_email end . . .
We create the corresponding delayed job in models/user.rb.
class User def activation_confirmation_mq mq = MsgQueue::UserActivationConfirm.new(id) Delayed::Job.enqueue(mq) end end
The call to Job#enqueue remains within each model to allow for passing a priority parameter, should that be needed.
Deployment on Heroku
Over a year ago, Heroku broadened its offering with a new feature that provides for multiple delayed_job workers per app. That capability sealed our decision to deploy, at least initially, on Heroku.