A Sidekiq Web extension to enqueue/schedule job in Web UI. Support both Sidekiq::Worker and ActiveJob.
Add this line to your application's Gemfile:
gem 'sidekiq-enqueuer'
And then execute:
$ bundle
Edit config/initializers/sidekiq.rb, add following line
require 'sidekiq/enqueuer'
Optionally, provide a list of Jobs to display on the new tab, on a new initializer file. Worry not, when no configuration is provided, All jobs will be displayed
# config/initializers/sidekiq_enqueuer_config.rb
require 'sidekiq/enqueuer'
Sidekiq::Enqueuer.configure do |config|
config.jobs = [MyAwesomeJob1, MyModule::MyAwesomeJob2]
end
Use default sidekiq queue adapter for Jobs including Sidekiq::Worker or Jobs inheriting from ActiveJob::base
ActiveJob::Base.queue_adapter = :sidekiq
https://github.com/mperham/sidekiq/wiki/Active-Job#active-job-setup
This gem dynamically infers the params required in the perform
or perform_in
action in your Job / Worker.
It is important those actions (either of them) won't hide the actual params into a single *args one.
In that case it will be impossible to infer the params for your method.
Want to verify this last line? Run this in a rails console:
MyJob.instance_method(:perform).parameters # change :perform for your implemented method
>> [[:req, :param1], [:opt, :param2], [:opt, :param3]] # Good output
=> [[:rest, :args], [:block, :block]] # Bad output. Params are being wrapped into a super class.
For Sidekiq, enqueing is being done using Sidekiq::Client.enqueue_to
/ enqueue_to_in
, providing Job, and queue extracted from the Job sidekiq_options hash, defaults to 'default' queue when not present.
For ActiveJob, enqueing is being done calling the very own perform_later
instance method. Please advise your Job should respond to perform_later
to correctly work.
-
Open Sidekiq Web, click the Enqueuer tab.
-
You can see a list of job classes/modules and params. Click Enqueue Form.
Bug reports and pull requests are welcome on GitHub at https://github.com/richfisher/sidekiq-enqueuer.