Afterparty
A Rails 4 compatible queue with support for executing jobs in the future and serialization with Redis.
Installation
Make sure you've installed redis on your machine.
Add this line to your application's Gemfile:
gem 'afterparty'
And then execute:
$ bundle
Or install it yourself as:
$ gem install afterparty
In your desired application environment, like application.rb
:
config.queue = Afterparty::RedisQueue.new
Usage
A job
is a ruby object with a run
method.
class Job
def run
puts "Hello!"
end
end
Then add it to the queue at any time.
Rails.queue << Job.new
If your job responds to an execute_at
method, the queue will wait to process that job until the specified time.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Add a test in
spec/redis_queue_spec.rb
- Make sure tests pass when you run
rake
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request