Disquo
Minimalist, threaded high-performance Ruby workers on top of Disque.
Installation
Add this to your Gemfile:
gem 'disquo'
Then execute:
$ bundle
Usage
Define a job:
require 'disquo'
class MyJob
include Disquo::Job
job_options queue: "notdefault", ttl: 3600, async: true
def perform(msg)
$stdout.puts "Hello #{msg}!"
end
end
# Enqueue with override
MyJob.enqueue ["World"], ttl: 7200
Create a worker config file:
queues: ["default", "notdefault"]
concurrency: <%= ENV['NUM_THREADS'] || 20 %>
Start a worker:
$ RACK_ENV=production disquo -C config/disquo.yaml -r config/environment.rb
I, [#12581] INFO -- : Starting worker - queues: ["default", "notdefault"], concurrency: 20
I, [#12581] INFO -- : Process {"klass":"MyJob","args":["World"]} - thread: 7807s, job: DI8613f71b34be272dff91e63fa576340076f169bf05a0SQ
...