/
base.rb
73 lines (59 loc) · 1.67 KB
/
base.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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