https://github.com/umbrellio/sidekiq-enqueuer
Sidekiq extension allowing to enqueue jobs in sidekiq panel
https://github.com/umbrellio/sidekiq-enqueuer
Last synced: 4 months ago
JSON representation
Sidekiq extension allowing to enqueue jobs in sidekiq panel
- Host: GitHub
- URL: https://github.com/umbrellio/sidekiq-enqueuer
- Owner: umbrellio
- License: mit
- Created: 2020-10-29T09:51:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-12T12:18:13.000Z (almost 4 years ago)
- Last Synced: 2025-06-27T18:43:20.730Z (12 months ago)
- Language: Ruby
- Size: 82 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Sidekiq::Enqueuer · [](https://badge.fury.io/gh/umbrellio%2Fsidekiq-enqueuer)  [](https://coveralls.io/github/umbrellio/sidekiq-enqueuer?branch=master)
A Sidekiq Web extension to enqueue/schedule job in Web UI. Support both Sidekiq::Worker and ActiveJob.
Based on [richfisher's sidekiq-enqueuer](https://github.com/richfisher/sidekiq-enqueuer).
## Installation
Add this line to your application's Gemfile:
```ruby
gem "sidekiq-enqueuer", github: "umbrellio/sidekiq-enqueuer"
```
And then execute:
```bash
$ bundle
```
Edit config/initializers/sidekiq.rb, add following line
```ruby
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.
```ruby
# config/initializers/sidekiq_enqueuer.rb
require "sidekiq/enqueuer"
Sidekiq::Enqueuer.configure do |config|
# string/symbol literals are used to when you prefer not to resolve job constants
config.jobs = %w[MyAwesomeJob1 MyModule::MyAwesomeJob2]
# you can use constants array as well
# config.jobs = [MyAwesomeJob1, MyModule::MyAwesomeJob2]
end
```
## Notes:
### Queuing & ActiveJob support
Use default sidekiq queue adapter for Jobs including Sidekiq::Worker or Jobs inheriting from ActiveJob::base.
```ruby
class Application < Rails::Application
# ...
config.active_job.queue_adapter = :sidekiq
end
```
https://github.com/mperham/sidekiq/wiki/Active-Job#active-job-setup
### Jobs action param mapping.
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:
```ruby
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.
```
### Enqueuing Jobs:
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.
## Usage
* Open Sidekiq Web, click the `Enqueuer` tab.
* You can see a list of job classes/modules and params. Click Enqueue.

* Fill the form, click Enqueue or Schedule.

* That is it!
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/sidekiq-scheduler.
## License
Released under MIT License.
## Authors
Team Umbrellio & [richfisher](mailto:richfisher.pan@gmail.com)
---