Class: Qs::DaemonData
- Inherits:
-
Object
- Object
- Qs::DaemonData
- Defined in:
- lib/qs/daemon_data.rb
Instance Attribute Summary collapse
-
#error_procs ⇒ Object
readonly
Returns the value of attribute error_procs.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#max_workers ⇒ Object
readonly
Returns the value of attribute max_workers.
-
#min_workers ⇒ Object
readonly
Returns the value of attribute min_workers.
-
#name ⇒ Object
readonly
The daemon uses this to “compile” its configuration for speed.
-
#pid_file ⇒ Object
readonly
Returns the value of attribute pid_file.
-
#process_label ⇒ Object
readonly
The daemon uses this to “compile” its configuration for speed.
-
#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
Returns the value of attribute shutdown_timeout.
-
#verbose_logging ⇒ Object
readonly
Returns the value of attribute verbose_logging.
-
#worker_shutdown_procs ⇒ Object
readonly
Returns the value of attribute worker_shutdown_procs.
-
#worker_sleep_procs ⇒ Object
readonly
Returns the value of attribute worker_sleep_procs.
-
#worker_start_procs ⇒ Object
readonly
Returns the value of attribute worker_start_procs.
-
#worker_wakeup_procs ⇒ Object
readonly
Returns the value of attribute worker_wakeup_procs.
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
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 20 def initialize(args = nil) args ||= {} @name = args[:name] @process_label = args[:process_label] @pid_file = args[:pid_file] @min_workers = args[:min_workers] @max_workers = args[:max_workers] @worker_start_procs = args[:worker_start_procs] @worker_shutdown_procs = args[:worker_shutdown_procs] @worker_sleep_procs = args[:worker_sleep_procs] @worker_wakeup_procs = args[:worker_wakeup_procs] @logger = args[:logger] @verbose_logging = !!args[:verbose_logging] @shutdown_timeout = args[:shutdown_timeout] @error_procs = args[:error_procs] || [] @queue_redis_keys = args[:queue_redis_keys] || [] @routes = build_routes(args[:routes] || []) end |
Instance Attribute Details
#error_procs ⇒ Object (readonly)
Returns the value of attribute error_procs.
17 18 19 |
# File 'lib/qs/daemon_data.rb', line 17 def error_procs @error_procs end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
15 16 17 |
# File 'lib/qs/daemon_data.rb', line 15 def logger @logger end |
#max_workers ⇒ Object (readonly)
Returns the value of attribute max_workers.
12 13 14 |
# File 'lib/qs/daemon_data.rb', line 12 def max_workers @max_workers end |
#min_workers ⇒ Object (readonly)
Returns the value of attribute min_workers.
12 13 14 |
# File 'lib/qs/daemon_data.rb', line 12 def min_workers @min_workers end |
#name ⇒ Object (readonly)
The daemon uses this to “compile” its configuration for speed. NsOptions is relatively slow everytime an option is read. To avoid this, we read the options one time here and memoize their values. This way, we don’t pay the NsOptions overhead when reading them while handling a message.
10 11 12 |
# File 'lib/qs/daemon_data.rb', line 10 def name @name end |
#pid_file ⇒ Object (readonly)
Returns the value of attribute pid_file.
11 12 13 |
# File 'lib/qs/daemon_data.rb', line 11 def pid_file @pid_file end |
#process_label ⇒ Object (readonly)
The daemon uses this to “compile” its configuration for speed. NsOptions is relatively slow everytime an option is read. To avoid this, we read the options one time here and memoize their values. This way, we don’t pay the NsOptions overhead when reading them while handling a message.
10 11 12 |
# File 'lib/qs/daemon_data.rb', line 10 def process_label @process_label end |
#queue_redis_keys ⇒ Object (readonly)
Returns the value of attribute queue_redis_keys.
18 19 20 |
# File 'lib/qs/daemon_data.rb', line 18 def queue_redis_keys @queue_redis_keys end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
18 19 20 |
# File 'lib/qs/daemon_data.rb', line 18 def routes @routes end |
#shutdown_timeout ⇒ Object (readonly)
Returns the value of attribute shutdown_timeout.
16 17 18 |
# File 'lib/qs/daemon_data.rb', line 16 def shutdown_timeout @shutdown_timeout end |
#verbose_logging ⇒ Object (readonly)
Returns the value of attribute verbose_logging.
15 16 17 |
# File 'lib/qs/daemon_data.rb', line 15 def verbose_logging @verbose_logging end |
#worker_shutdown_procs ⇒ Object (readonly)
Returns the value of attribute worker_shutdown_procs.
13 14 15 |
# File 'lib/qs/daemon_data.rb', line 13 def worker_shutdown_procs @worker_shutdown_procs end |
#worker_sleep_procs ⇒ Object (readonly)
Returns the value of attribute worker_sleep_procs.
14 15 16 |
# File 'lib/qs/daemon_data.rb', line 14 def worker_sleep_procs @worker_sleep_procs end |
#worker_start_procs ⇒ Object (readonly)
Returns the value of attribute worker_start_procs.
13 14 15 |
# File 'lib/qs/daemon_data.rb', line 13 def worker_start_procs @worker_start_procs end |
#worker_wakeup_procs ⇒ Object (readonly)
Returns the value of attribute worker_wakeup_procs.
14 15 16 |
# File 'lib/qs/daemon_data.rb', line 14 def worker_wakeup_procs @worker_wakeup_procs 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 |