Class: Qs::DaemonData
- Inherits:
-
Object
- Object
- Qs::DaemonData
- Defined in:
- lib/qs/daemon_data.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#dwp_logger ⇒ Object
readonly
Returns the value of attribute dwp_logger.
-
#error_procs ⇒ Object
readonly
Returns the value of attribute error_procs.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#name ⇒ Object
readonly
The daemon uses this to “compile” the common configuration data used by the daemon instances, error handlers and routes.
-
#num_workers ⇒ Object
readonly
Returns the value of attribute num_workers.
-
#pid_file ⇒ Object
readonly
The daemon uses this to “compile” the common configuration data used by the daemon instances, error handlers and routes.
-
#process_label ⇒ Object
readonly
Returns the value of attribute process_label.
-
#queue_redis_keys ⇒ Object
readonly
Returns the value of attribute queue_redis_keys.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
-
#shutdown_timeout ⇒ Object
readonly
The daemon uses this to “compile” the common configuration data used by the daemon instances, error handlers and routes.
-
#verbose_logging ⇒ Object
readonly
Returns the value of attribute verbose_logging.
-
#worker_class ⇒ Object
readonly
Returns the value of attribute worker_class.
-
#worker_params ⇒ Object
readonly
Returns the value of attribute worker_params.
Instance Method Summary collapse
-
#initialize(args = nil) ⇒ DaemonData
constructor
A new instance of DaemonData.
- #route_for(route_id) ⇒ Object
Constructor Details
#initialize(args = nil) ⇒ DaemonData
Returns a new instance of DaemonData.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/qs/daemon_data.rb', line 16 def initialize(args = nil) args ||= {} @name = args[:name] @pid_file = args[:pid_file] @shutdown_timeout = args[:shutdown_timeout] @worker_class = args[:worker_class] @worker_params = args[:worker_params] || {} @num_workers = args[:num_workers] @error_procs = args[:error_procs] || [] @logger = args[:logger] @queue_redis_keys = (args[:queues] || []).map(&:redis_key) @verbose_logging = !!args[:verbose_logging] @debug = !ENV['QS_DEBUG'].to_s.empty? @dwp_logger = @logger if @debug @routes = build_routes(args[:routes] || []) @process_label = !(v = ENV['QS_PROCESS_LABEL'].to_s).empty? ? v : @name end |
Instance Attribute Details
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
14 15 16 |
# File 'lib/qs/daemon_data.rb', line 14 def debug @debug end |
#dwp_logger ⇒ Object (readonly)
Returns the value of attribute dwp_logger.
14 15 16 |
# File 'lib/qs/daemon_data.rb', line 14 def dwp_logger @dwp_logger end |
#error_procs ⇒ Object (readonly)
Returns the value of attribute error_procs.
12 13 14 |
# File 'lib/qs/daemon_data.rb', line 12 def error_procs @error_procs end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/qs/daemon_data.rb', line 12 def logger @logger end |
#name ⇒ Object (readonly)
The daemon uses this to “compile” the common configuration data used by the daemon instances, error handlers and routes. The goal here is to provide these with a simplified interface with the minimal data needed and to decouple the configuration from each thing that needs its data.
10 11 12 |
# File 'lib/qs/daemon_data.rb', line 10 def name @name end |
#num_workers ⇒ Object (readonly)
Returns the value of attribute num_workers.
11 12 13 |
# File 'lib/qs/daemon_data.rb', line 11 def num_workers @num_workers end |
#pid_file ⇒ Object (readonly)
The daemon uses this to “compile” the common configuration data used by the daemon instances, error handlers and routes. The goal here is to provide these with a simplified interface with the minimal data needed and to decouple the configuration from each thing that needs its data.
10 11 12 |
# File 'lib/qs/daemon_data.rb', line 10 def pid_file @pid_file end |
#process_label ⇒ Object (readonly)
Returns the value of attribute process_label.
14 15 16 |
# File 'lib/qs/daemon_data.rb', line 14 def process_label @process_label end |
#queue_redis_keys ⇒ Object (readonly)
Returns the value of attribute queue_redis_keys.
12 13 14 |
# File 'lib/qs/daemon_data.rb', line 12 def queue_redis_keys @queue_redis_keys end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
14 15 16 |
# File 'lib/qs/daemon_data.rb', line 14 def routes @routes end |
#shutdown_timeout ⇒ Object (readonly)
The daemon uses this to “compile” the common configuration data used by the daemon instances, error handlers and routes. The goal here is to provide these with a simplified interface with the minimal data needed and to decouple the configuration from each thing that needs its data.
10 11 12 |
# File 'lib/qs/daemon_data.rb', line 10 def shutdown_timeout @shutdown_timeout end |
#verbose_logging ⇒ Object (readonly)
Returns the value of attribute verbose_logging.
13 14 15 |
# File 'lib/qs/daemon_data.rb', line 13 def verbose_logging @verbose_logging end |
#worker_class ⇒ Object (readonly)
Returns the value of attribute worker_class.
11 12 13 |
# File 'lib/qs/daemon_data.rb', line 11 def worker_class @worker_class end |
#worker_params ⇒ Object (readonly)
Returns the value of attribute worker_params.
11 12 13 |
# File 'lib/qs/daemon_data.rb', line 11 def worker_params @worker_params end |
Instance Method Details
#route_for(route_id) ⇒ Object
39 40 41 |
# File 'lib/qs/daemon_data.rb', line 39 def route_for(route_id) @routes[route_id] || raise(NotFoundError, "unknown message '#{route_id}'") end |