Cloudist: Simple, scalable job queue for Ruby powered by AMQP and Event Machine
Rubyists seeking to move processing to the background have long relied
on projects like Delayed
Job and
Resque. Now, Ivan
Vanderbyl offers another option.
Cloudist is powered by
AMQP and EventMachine and aims to provide a simple
yet highly scalable job queue for Ruby apps.
Cloudist workers can be in the form of a block:
Cloudist.start {
log.info("Started Worker")
job('make.sandwich') {
log.info("JOB (#{id}) Make sandwich with #{data[:bread]} bread")
job.started!
(1..20).each do |i|
job.progress(i * 5)
sleep(1)
raise ArgumentError, "NOT GOOD!" if i == 4
end
job.finished!
}
}
… or a Ruby class:
class SandwichWorker < Cloudist::Worker
def process
log.info("Processing queue: #{queue.name}")
log.info(data.inspect)
job.started!
(1..5).each do |i|
job.progress(i * 20)
# sleep(1)
# raise ArgumentError, "NOT GOOD!" if i == 4
end
job.finished!
end
end
Cloudist.signal_trap!
Cloudist.start(:heartbeat => 10, :logging => false) {
Cloudist.handle('make.sandwich').with(SandwichWorker)
}
For usage, configuration, and more examples, check out the project repo
on GitHub.
Discussion
Sign in or Join to comment or subscribe