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
22
# 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_publish_queue
    work_subscribe_queue
  )
end

.from_file(file_path) ⇒ Object



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

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



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

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

#delayed_queue_prefixObject



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

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

#envObject



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

def env
  @env || 'production'
end

#error_queueObject



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

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

#time_zoneObject



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

def time_zone
  @time_zone || 'UTC'
end

#work_exchangeObject



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

def work_exchange
  @work_exchange || 'work'
end

#work_exchange_typeObject



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

def work_exchange_type
  @work_exchange_type || 'fanout'
end

#work_log_levelObject



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

def work_log_level
  @work_log_level || 'info'
end

#work_log_pathObject



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

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

#work_publish_queueObject



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

def work_publish_queue
  @work_publish_queue || 'work'
end

#work_subscribe_queueObject



77
78
79
# File 'lib/rabbit_wq/configuration.rb', line 77

def work_subscribe_queue
  @work_subscribe_queue || 'work'
end