Class: Backburner::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/backburner/configuration.rb

Constant Summary collapse

PRIORITY_LABELS =
{ :high => 0, :medium => 5, :low => 9 }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/backburner/configuration.rb', line 23

def initialize
  @allq_url       = "allq://127.0.0.1:8090"
  @tube_namespace      = "backburner"
  @namespace_separator = "."
  @default_priority    = 5
  @respond_timeout     = 120
  @on_error            = nil
  @max_job_retries     = 1
  @retry_delay         = 5
  @retry_delay_proc    = lambda { |min_retry_delay, num_retries| min_retry_delay + (num_retries ** 3) }
  @default_queues      = []
  @logger              = nil
  @default_worker      = Backburner::Workers::Simple
  @primary_queue       = "backburner-jobs"
  @priority_labels     = PRIORITY_LABELS
  @reserve_timeout     = nil
  @job_serializer_proc = lambda { |body| body.to_json }
  @job_parser_proc     = lambda { |body| JSON.parse(body) }
end

Instance Attribute Details

#allq_urlObject

beanstalk url connection



5
6
7
# File 'lib/backburner/configuration.rb', line 5

def allq_url
  @allq_url
end

#default_priorityObject

default job priority



8
9
10
# File 'lib/backburner/configuration.rb', line 8

def default_priority
  @default_priority
end

#default_queuesObject

default queues



14
15
16
# File 'lib/backburner/configuration.rb', line 14

def default_queues
  @default_queues
end

#default_workerObject

default worker class



16
17
18
# File 'lib/backburner/configuration.rb', line 16

def default_worker
  @default_worker
end

#job_parser_procObject

proc to parse a job body from a string



21
22
23
# File 'lib/backburner/configuration.rb', line 21

def job_parser_proc
  @job_parser_proc
end

#job_serializer_procObject

proc to write the job body to a string



20
21
22
# File 'lib/backburner/configuration.rb', line 20

def job_serializer_proc
  @job_serializer_proc
end

#loggerObject

logger



15
16
17
# File 'lib/backburner/configuration.rb', line 15

def logger
  @logger
end

#max_job_retriesObject

max job retries



11
12
13
# File 'lib/backburner/configuration.rb', line 11

def max_job_retries
  @max_job_retries
end

#namespace_separatorObject

namespace separator



7
8
9
# File 'lib/backburner/configuration.rb', line 7

def namespace_separator
  @namespace_separator
end

#on_errorObject

error handler



10
11
12
# File 'lib/backburner/configuration.rb', line 10

def on_error
  @on_error
end

#primary_queueObject

the general queue



17
18
19
# File 'lib/backburner/configuration.rb', line 17

def primary_queue
  @primary_queue
end

#priority_labelsObject

priority labels



18
19
20
# File 'lib/backburner/configuration.rb', line 18

def priority_labels
  @priority_labels
end

#reserve_timeoutObject

duration to wait to reserve on a single server



19
20
21
# File 'lib/backburner/configuration.rb', line 19

def reserve_timeout
  @reserve_timeout
end

#respond_timeoutObject

default job timeout



9
10
11
# File 'lib/backburner/configuration.rb', line 9

def respond_timeout
  @respond_timeout
end

#retry_delayObject

(minimum) retry delay in seconds



12
13
14
# File 'lib/backburner/configuration.rb', line 12

def retry_delay
  @retry_delay
end

#retry_delay_procObject

proc to calculate delay (and allow for back-off)



13
14
15
# File 'lib/backburner/configuration.rb', line 13

def retry_delay_proc
  @retry_delay_proc
end

#tube_namespaceObject

namespace prefix for every queue



6
7
8
# File 'lib/backburner/configuration.rb', line 6

def tube_namespace
  @tube_namespace
end