Class: RabbitWQ::Configuration

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attributesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rabbit_wq/configuration.rb', line 6

def self.attributes
  %w(
    delayed_exchange_prefix
    delayed_queue_prefix
    environment_file_path
    env
    error_queue
    threads
    time_zone
    work_exchange
    work_exchange_type
    work_log_level
    work_log_path
    work_queue
  )
end

.from_file(file_path) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/rabbit_wq/configuration.rb', line 25

def self.from_file( file_path )
  options = Oj.load( File.read( file_path ))
  RabbitWQ.configuration = Configuration.new

  attributes.each do |c|
    if options[c]
      RabbitWQ.configuration.send( :"#{c}=", options[c] )
    end
  end
end

Instance Method Details

#delayed_exchange_prefixObject



36
37
38
# File 'lib/rabbit_wq/configuration.rb', line 36

def delayed_exchange_prefix
  @delayed_exchange_prefix || 'work-delay'
end

#delayed_queue_prefixObject



40
41
42
# File 'lib/rabbit_wq/configuration.rb', line 40

def delayed_queue_prefix
  @delayed_queue_prefix || 'work-delay'
end

#envObject



44
45
46
# File 'lib/rabbit_wq/configuration.rb', line 44

def env
  @env || 'production'
end

#error_queueObject



48
49
50
# File 'lib/rabbit_wq/configuration.rb', line 48

def error_queue
  @error_queue || 'work-error'
end

#time_zoneObject



52
53
54
# File 'lib/rabbit_wq/configuration.rb', line 52

def time_zone
  @time_zone || 'UTC'
end

#work_exchangeObject



56
57
58
# File 'lib/rabbit_wq/configuration.rb', line 56

def work_exchange
  @work_exchange || 'work'
end

#work_exchange_typeObject



60
61
62
# File 'lib/rabbit_wq/configuration.rb', line 60

def work_exchange_type
  @work_exchange_type || 'fanout'
end

#work_log_levelObject



64
65
66
# File 'lib/rabbit_wq/configuration.rb', line 64

def work_log_level
  @work_log_level || 'info'
end

#work_log_pathObject



68
69
70
# File 'lib/rabbit_wq/configuration.rb', line 68

def work_log_path
  @work_log_path || '/var/log/rabbit-wq/rabbit-wq-work.log'
end

#work_queueObject



72
73
74
# File 'lib/rabbit_wq/configuration.rb', line 72

def work_queue
  @work_queue || 'work'
end