Class: Barbeque::MessageQueue
- Inherits:
-
Object
- Object
- Barbeque::MessageQueue
- Defined in:
- lib/barbeque/message_queue.rb
Instance Attribute Summary collapse
-
#job_queue ⇒ Object
readonly
Returns the value of attribute job_queue.
Instance Method Summary collapse
-
#delete_message(message) ⇒ Object
Remove a message from SQS queue.
-
#dequeue ⇒ Barbeque::Message::Base
Receive a message from SQS queue.
-
#initialize(job_queue) ⇒ MessageQueue
constructor
A new instance of MessageQueue.
- #stop! ⇒ Object
Constructor Details
#initialize(job_queue) ⇒ MessageQueue
Returns a new instance of MessageQueue.
9 10 11 12 13 |
# File 'lib/barbeque/message_queue.rb', line 9 def initialize(job_queue) @job_queue = job_queue @messages = [] @stop = false end |
Instance Attribute Details
#job_queue ⇒ Object (readonly)
Returns the value of attribute job_queue.
7 8 9 |
# File 'lib/barbeque/message_queue.rb', line 7 def job_queue @job_queue end |
Instance Method Details
#delete_message(message) ⇒ Object
Remove a message from SQS queue.
33 34 35 36 37 38 |
# File 'lib/barbeque/message_queue.rb', line 33 def () client.( queue_url: @job_queue.queue_url, receipt_handle: .receipt_handle, ) end |
#dequeue ⇒ Barbeque::Message::Base
Receive a message from SQS queue.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/barbeque/message_queue.rb', line 17 def dequeue loop do return nil if @stop = if if .valid? return else () end end end end |
#stop! ⇒ Object
40 41 42 |
# File 'lib/barbeque/message_queue.rb', line 40 def stop! @stop = true end |