Class: Slnky::Service::Queues
- Inherits:
-
Object
- Object
- Slnky::Service::Queues
- Defined in:
- lib/slnky/service/queues.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #create(name, exchange, overrides = {}) ⇒ Object
- #each ⇒ Object
-
#initialize(channel) ⇒ Queues
constructor
A new instance of Queues.
Constructor Details
#initialize(channel) ⇒ Queues
Returns a new instance of Queues.
4 5 6 7 |
# File 'lib/slnky/service/queues.rb', line 4 def initialize(channel) @channel = channel @queues = {} end |
Instance Method Details
#[](name) ⇒ Object
16 17 18 |
# File 'lib/slnky/service/queues.rb', line 16 def [](name) @queues["service.#{name}.events"] || @queues[name] || raise("no queue found: #{name}") end |
#create(name, exchange, overrides = {}) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/slnky/service/queues.rb', line 9 def create(name, exchange, overrides={}) = { durable: true }.merge(overrides) @queues[name] = @channel.queue("service.#{name}.events", ).bind(exchange) end |
#each ⇒ Object
20 21 22 23 24 |
# File 'lib/slnky/service/queues.rb', line 20 def each @queues.each do |name, exchange| yield name, exchange end end |