Class: Barbeque::Runner
- Inherits:
-
Object
- Object
- Barbeque::Runner
- Defined in:
- lib/barbeque/runner.rb
Overview
Part of barbeque-worker. Runner dequeues a message from MessageQueue (Amazon SQS) and dispatches it to message handler.
Instance Method Summary collapse
-
#initialize(job_queue) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(job_queue) ⇒ Runner
Returns a new instance of Runner.
13 14 15 |
# File 'lib/barbeque/runner.rb', line 13 def initialize(job_queue) @job_queue = job_queue end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/barbeque/runner.rb', line 17 def run keep_maximum_concurrent_executions = .dequeue return unless Barbeque::ExceptionHandler.(.id, .type) handler = MessageHandler.const_get(.type, false) handler.new(message: , message_queue: ).run end |
#stop ⇒ Object
28 29 30 |
# File 'lib/barbeque/runner.rb', line 28 def stop .stop! end |