Class: Promiscuous::Subscriber::Worker::Runner
- Inherits:
-
Object
- Object
- Promiscuous::Subscriber::Worker::Runner
- Defined in:
- lib/promiscuous/subscriber/worker/runner.rb
Defined Under Namespace
Classes: RunnerThread
Instance Attribute Summary collapse
-
#messages_to_process ⇒ Object
Returns the value of attribute messages_to_process.
Instance Method Summary collapse
-
#initialize(root) ⇒ Runner
constructor
A new instance of Runner.
- #show_stop_status(num_requests) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
Instance Attribute Details
#messages_to_process ⇒ Object
Returns the value of attribute messages_to_process.
2 3 4 |
# File 'lib/promiscuous/subscriber/worker/runner.rb', line 2 def @messages_to_process end |
Instance Method Details
#show_stop_status(num_requests) ⇒ Object
23 24 25 |
# File 'lib/promiscuous/subscriber/worker/runner.rb', line 23 def show_stop_status(num_requests) @runner_threads.to_a.each { |runner_thread| runner_thread.show_stop_status(num_requests) } end |
#start ⇒ Object
9 10 11 12 |
# File 'lib/promiscuous/subscriber/worker/runner.rb', line 9 def start num_threads = Promiscuous::Config.subscriber_threads @runner_threads ||= num_threads.times.map { RunnerThread.new(@messages_to_process) } end |
#stop ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/promiscuous/subscriber/worker/runner.rb', line 14 def stop return unless @runner_threads @runner_threads.each { |runner_thread| runner_thread.stop } @runner_threads = nil @messages_to_process.clear end |