module Backburner
Constants
- VERSION
Public Class Methods
configuration()
click to toggle source
Returns the configuration options set for Backburner
@example
Backburner.configuration.beanstalk_url => false
# File lib/backburner.rb, line 60 def configuration @_configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
Yields a configuration block
@example
Backburner.configure do |config| config.beanstalk_url = "beanstalk://..." end
# File lib/backburner.rb, line 50 def configure(&block) yield(configuration) configuration end
default_queues()
click to toggle source
Returns the queues that are processed by default if none are specified
@example
Backburner.default_queues << "foo" Backburner.default_queues => ["foo", "bar"]
# File lib/backburner.rb, line 70 def default_queues configuration.default_queues end
enqueue(job_class, *args)
click to toggle source
Enqueues a job to be performed with given arguments.
@example
Backburner.enqueue NewsletterSender, self.id, user.id
# File lib/backburner.rb, line 27 def enqueue(job_class, *args) Backburner::Worker.enqueue(job_class, args, {}) end
work(*tubes)
click to toggle source
Begins working on jobs enqueued with optional tubes specified
@example
Backburner.work('newsletter_sender', 'test_job') Backburner.work('newsletter_sender', 'test_job', :worker => NotSimpleWorker)
# File lib/backburner.rb, line 37 def work(*tubes) options = tubes.last.is_a?(Hash) ? tubes.pop : {} worker_class = options[:worker] || configuration.default_worker worker_class.start(tubes) end