Class: Resque::Failure::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/failure/base.rb

Overview

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.

Direct Known Subclasses

Hoptoad, Mongo, Multiple, Redis

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception, worker, queue, payload) ⇒ Base

Returns a new instance of Base.



20
21
22
23
24
25
# File 'lib/resque/failure/base.rb', line 20

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

Instance Attribute Details

#exceptionObject

The exception object raised by the failed job



9
10
11
# File 'lib/resque/failure/base.rb', line 9

def exception
  @exception
end

#payloadObject

The payload object associated with the failed job



18
19
20
# File 'lib/resque/failure/base.rb', line 18

def payload
  @payload
end

#queueObject

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



15
16
17
# File 'lib/resque/failure/base.rb', line 15

def queue
  @queue
end

#workerObject

The worker object who detected the failure



12
13
14
# File 'lib/resque/failure/base.rb', line 12

def worker
  @worker
end

Class Method Details

.all(start = 0, count = 1) ⇒ Object

Returns a paginated array of failure objects.



45
46
47
# File 'lib/resque/failure/base.rb', line 45

def self.all(start = 0, count = 1)
  []
end

.clearObject

Clear all failure objects



59
60
# File 'lib/resque/failure/base.rb', line 59

def self.clear
end

.countObject

The number of failures.



35
36
37
# File 'lib/resque/failure/base.rb', line 35

def self.count
  0
end

.remove(index) ⇒ Object



65
66
# File 'lib/resque/failure/base.rb', line 65

def self.remove(index)
end

.requeue(index) ⇒ Object



62
63
# File 'lib/resque/failure/base.rb', line 62

def self.requeue(index)
end

.search_countObject

The number of failures after a search.



40
41
42
# File 'lib/resque/failure/base.rb', line 40

def self.search_count
  0
end

.search_results(query, start = 0, count = 1) ⇒ Object

Returns a paginated array of failure objects after a search.



50
51
52
# File 'lib/resque/failure/base.rb', line 50

def self.search_results(query, start = 0, count = 1)
  []
end

.urlObject

A URL where someone can go to view failures.



55
56
# File 'lib/resque/failure/base.rb', line 55

def self.url
end

Instance Method Details

#log(message) ⇒ Object

Logging!



69
70
71
# File 'lib/resque/failure/base.rb', line 69

def log(message)
  @worker.log(message)
end

#saveObject

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.



31
32
# File 'lib/resque/failure/base.rb', line 31

def save
end