Class: MQueue::Protocols::SQS
- Inherits:
-
Object
- Object
- MQueue::Protocols::SQS
- Defined in:
- lib/m_queue/protocols/sqs.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #[](queue_name) ⇒ Object
- #[]=(queue_name, msg) ⇒ Object
-
#alive? ⇒ Boolean
MQueue Protocol API.
- #delete(queue_name) ⇒ Object
- #delete! ⇒ Object
-
#initialize(opts = {}) ⇒ SQS
constructor
A new instance of SQS.
- #weight ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ SQS
Returns a new instance of SQS.
8 9 10 |
# File 'lib/m_queue/protocols/sqs.rb', line 8 def initialize(opts = {}) self. = opts end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/m_queue/protocols/sqs.rb', line 6 def @options end |
Instance Method Details
#[](queue_name) ⇒ Object
19 20 21 22 |
# File 'lib/m_queue/protocols/sqs.rb', line 19 def [](queue_name) msg = queue(queue_name). msg.body if msg end |
#[]=(queue_name, msg) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/m_queue/protocols/sqs.rb', line 12 def []=(queue_name, msg) queue(queue_name).(msg) msg rescue => e raise ConnectionError end |
#alive? ⇒ Boolean
MQueue Protocol API
36 37 38 |
# File 'lib/m_queue/protocols/sqs.rb', line 36 def alive? true end |
#delete(queue_name) ⇒ Object
24 25 26 |
# File 'lib/m_queue/protocols/sqs.rb', line 24 def delete(queue_name) queue(queue_name).delete! end |
#delete! ⇒ Object
28 29 30 31 32 |
# File 'lib/m_queue/protocols/sqs.rb', line 28 def delete! ::SQS.each_queue do |q| q.delete! end end |
#weight ⇒ Object
40 41 42 |
# File 'lib/m_queue/protocols/sqs.rb', line 40 def weight [:weight] || 0 end |