Sidekiq job as plugin

(Tyler Gillies) #1

Has anyone discovered a way to add a sidekiq job as a plugin?

(Sam Saffron) #2

Sure, there is an example here:


(eriko) #3

So I am trying to do this with a new plugin and I have used both the example here for the blog plugin and the one for akismet. The first puts the job files in ./app/jobs and uses module Blog which I think comes from the engine the plugin also creates. The second one, akismet, uses ./jobs and the module Jobs. In both cases the job does not get added to sidekiq after I restart the app and sidekiq. Can you tell me how the job gets loaded?

in you plugin.rb you need to load the jobs file no matter where it is like the following:

require_dependency File.expand_path('../jobs/import_users.rb', __FILE__)

(eriko) #4

So while this works it does not seem that there is anyway to see if the jobs are running other than in sidekiq/scheduler . The plug in jobs are not listed in

  • Dashboard
  • Busy
  • Queues
  • Scheduled
  • Statistic
  • Scheduler

I am creating the jobs with:
class SuspendUsers < ::Jobs::Scheduled every

Do I need them to be an another queue or get another queue displayed in sidekiq?