class Liebre::Actor::Context::Declare

Attributes

chan[R]

Public Class Methods

new(chan) click to toggle source
# File lib/liebre/actor/context/declare.rb, line 6
def initialize chan
  @chan = chan
end

Public Instance Methods

bind(queue, exchange, config = {}) click to toggle source
# File lib/liebre/actor/context/declare.rb, line 29
def bind queue, exchange, config = {}
  all_opts = [config].flatten

  all_opts.each do |opts|
    queue.bind(exchange, opts)
  end
end
default_exchange() click to toggle source
# File lib/liebre/actor/context/declare.rb, line 10
def default_exchange
  chan.default_exchange
end
exchange(config) click to toggle source
# File lib/liebre/actor/context/declare.rb, line 14
def exchange config
  name = config.fetch(:name)
  type = config.fetch(:type)
  opts = config.fetch(:opts, {})

  chan.exchange(name, type, opts)
end
queue(config) click to toggle source
# File lib/liebre/actor/context/declare.rb, line 22
def queue config
  name = config.fetch(:name)
  opts = config.fetch(:opts, {})

  chan.queue(name, opts)
end