Sha256: f83f390aaf94d41be6dfb55b6bb97bae1505463f6ce6ef38c16213145bad89df

Contents?: true

Size: 669 Bytes

Versions: 71

Compression:

Stored size: 669 Bytes

Contents

$:.unshift "lib"
require 'backburner'

$error = 0

class User
  include Backburner::Performable
  attr_accessor :id, :name

  def self.foo(x, y)
    $error += 1
    raise "fail #{$error}" unless $error > 3
    puts "User #foo args [#{x}, #{y}] Success!!"
  end
end

# Configure Backburner
Backburner.configure do |config|
  config.beanstalk_url = "beanstalk://127.0.0.1"
  config.tube_namespace = "demo.production"
  config.on_error = lambda { |e| puts "HEY!!! #{e.class}" }
  config.max_job_retries = 3
  config.retry_delay     = 0
end

# Enqueue tasks
User.async(:queue => "retried").foo("bar", "baz")

# Run work
# Backburner.default_queues << "user"
Backburner.work

Version data entries

71 entries across 71 versions & 2 rubygems

Version Path
backburner-allq-1.0.50 examples/retried.rb
backburner-allq-1.0.49 examples/retried.rb
backburner-allq-1.0.48 examples/retried.rb
backburner-1.6.1 examples/retried.rb
backburner-allq-1.0.47 examples/retried.rb
backburner-allq-1.0.46 examples/retried.rb
backburner-allq-1.0.45 examples/retried.rb
backburner-allq-1.0.44 examples/retried.rb
backburner-allq-1.0.40 examples/retried.rb
backburner-allq-1.0.39 examples/retried.rb
backburner-allq-1.0.38 examples/retried.rb
backburner-allq-1.0.37 examples/retried.rb
backburner-allq-1.0.36 examples/retried.rb
backburner-1.6.0 examples/retried.rb
backburner-allq-1.0.35 examples/retried.rb
backburner-allq-1.0.34 examples/retried.rb
backburner-allq-1.0.33 examples/retried.rb
backburner-allq-1.0.32 examples/retried.rb
backburner-allq-1.0.31 examples/retried.rb
backburner-allq-1.0.29 examples/retried.rb