Sha256: d706bd29f754672cbb59592eaca84f5621123a21e91688ab1f9ce4cb7c28af6f

Contents?: true

Size: 1.67 KB

Versions: 20

Compression:

Stored size: 1.67 KB

Contents

module Resque
  module Failure
    # All Failure classes are expected to subclass Base.
    #
    # When a job fails, a new instance of your Failure backend is created
    # and #save is called.
    class Base
      # The exception object raised by the failed job
      attr_accessor :exception

      # The worker object who detected the failure
      attr_accessor :worker

      # The string name of the queue from which the failed job was pulled
      attr_accessor :queue

      # The payload object associated with the failed job
      attr_accessor :payload

      def initialize(exception, worker, queue, payload)
        @exception = exception
        @worker    = worker
        @queue     = queue
        @payload   = payload
      end

      # When a job fails, a new instance of your Failure backend is created
      # and #save is called.
      #
      # This is where you POST or PUT or whatever to your Failure service.
      def save
      end

      # The number of failures.
      def self.count(queue = nil, class_name = nil)
        0
      end

      # Returns an array of all available failure queues
      def self.queues
        []
      end

      # Returns a paginated array of failure objects.
      def self.all(offset = 0, limit = 1, queue = nil)
        []
      end

      # Iterate across failed objects
      def self.each(*args)
      end

      # A URL where someone can go to view failures.
      def self.url
      end

      # Clear all failure objects
      def self.clear(*args)
      end

      def self.requeue(*args)
      end

      def self.remove(*args)
      end

      # Logging!
      def log(message)
        @worker.log(message)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
resque-2.7.0 lib/resque/failure/base.rb
resque-2.6.0 lib/resque/failure/base.rb
resque-2.5.0 lib/resque/failure/base.rb
resque-2.4.0 lib/resque/failure/base.rb
resque-2.3.0 lib/resque/failure/base.rb
resque-2.2.1 lib/resque/failure/base.rb
resque-2.2.0 lib/resque/failure/base.rb
resque-2.1.0 lib/resque/failure/base.rb
resque-2.0.0 lib/resque/failure/base.rb
resque_admin-1.0.4 lib/resque_admin/failure/base.rb
resque_admin-1.0.3 lib/resque/failure/base.rb
resque_admin-1.0.2 lib/resque/failure/base.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/resque-1.27.4/lib/resque/failure/base.rb
resque-1.27.4 lib/resque/failure/base.rb
resque-1.27.3 lib/resque/failure/base.rb
resque-1.27.2 lib/resque/failure/base.rb
resque-1.27.1 lib/resque/failure/base.rb
resque-1.27.0 lib/resque/failure/base.rb
resqueue-1.0.0 lib/resque/failure/base.rb
resque-master-0.0.3 lib/resque/failure/base.rb