EMAIL_QUEUE = GirlFriday::WorkQueue.new(:email) do |msg| UserMailer.registration_email(msg).deliver end
EMAIL_QUEUE.push(:email => @user.email, :name => @user.name)
Pros
Cons
Post.find(9).send_to_twitter!
Post.find(9).delay.send_to_twitter!
rake jobs:work
Pros
Cons
class Archive @queue = :file_serve def self.perform(repo_id, branch = 'master') repo = Repository.find(repo_id) repo.create_archive(branch) end end
Resque.enqueue(Archive, self.id, branch)
QUEUE=file_serve rake resque:work
Pros
Cons
Celluloid is a concurrent object oriented programming framework for Ruby which lets you build multithreaded programs out of concurrent objects just as easily as you build sequential programs out of regular objects
SuckerPunch.config do queue name: :log_queue, worker: LogWorker, size: 10 queue name: :awesome_queue, worker: AwesomeWorker, size: 2 end
class LogWorker include SuckerPunch::Worker def perform(event) Log.new(event).track end end
SuckerPunch::Queue[:log_queue].perform("login")
SuckerPunch::Queue[:log_queue].async.perform("login")
Pros
Cons
class HardWorker include Sidekiq::Worker def perform(name, count) puts 'Doing hard work' end end
HardWorker.perform_async('bob', 5)
sidekiq -c 25
Pros
Cons