QueueManager
Queue manager for Rails application. Based on Redis (Sorted Set).
Installation
Add this line to your application's Gemfile:
gem 'queue_manager'
And then execute:
$ bundle
Or install it yourself as:
$ gem install queue_manager
Run installer:
$ rails generate queue_manager:install
Usage
Add the name of class worker in config/initializers/queue_manager.rb:
# Used sidekiq worker. Invokes method perform_async on this class
config.worker = 'SidekiqWorker' # Default: nil
Start queue manager daemon:
$ rake queue_manager:start
Add task to the queue:
score = QueueManager::Task.add(7)
score - weight of task. Used to remove.
After 5 seconds, will be launched SidekiqWorker.perform_async(7).
Remove task from the queue:
QueueManager::Task.remove(7, score)
Stop queue manager daemon
$ rake queue_manager:stop
Contributing
- Fork it ( https://github.com/[my-github-username]/queue_manager/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request