Class: CottonTail::Queue::Supervisor
- Inherits:
-
Object
- Object
- CottonTail::Queue::Supervisor
- Defined in:
- lib/cotton_tail/queue/supervisor.rb
Overview
A supervisor for a single queue
Instance Method Summary collapse
-
#initialize(queue, app:) ⇒ Supervisor
constructor
A new instance of Supervisor.
-
#run ⇒ Object
Start the supervisor, process all pending messages, and then stop.
- #running? ⇒ Boolean
- #start ⇒ Object
Constructor Details
#initialize(queue, app:) ⇒ Supervisor
Returns a new instance of Supervisor.
9 10 11 12 |
# File 'lib/cotton_tail/queue/supervisor.rb', line 9 def initialize(queue, app:) @queue = queue @app = app end |
Instance Method Details
#run ⇒ Object
Start the supervisor, process all pending messages, and then stop
19 20 21 22 |
# File 'lib/cotton_tail/queue/supervisor.rb', line 19 def run @queue.close start.tap(&:join) end |
#running? ⇒ Boolean
24 25 26 |
# File 'lib/cotton_tail/queue/supervisor.rb', line 24 def running? true & process.status end |
#start ⇒ Object
14 15 16 |
# File 'lib/cotton_tail/queue/supervisor.rb', line 14 def start process end |