Class: Liebre::Adapter::Bunny::Chan

Inherits:
Object
  • Object
show all
Includes:
Interface::Chan
Defined in:
lib/liebre/adapter/bunny/chan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ Chan

Returns a new instance of Chan.



9
10
11
# File 'lib/liebre/adapter/bunny/chan.rb', line 9

def initialize channel
  @channel = channel
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



7
8
9
# File 'lib/liebre/adapter/bunny/chan.rb', line 7

def channel
  @channel
end

Instance Method Details

#closeObject



31
32
33
# File 'lib/liebre/adapter/bunny/chan.rb', line 31

def close
  channel.close
end

#default_exchangeObject



13
14
15
# File 'lib/liebre/adapter/bunny/chan.rb', line 13

def default_exchange
  Exchange.new(channel.default_exchange)
end

#exchange(name, type, opts) ⇒ Object



17
18
19
20
21
# File 'lib/liebre/adapter/bunny/chan.rb', line 17

def exchange name, type, opts
  opts = opts.merge(:type => type)

  Exchange.new(channel.exchange(name, opts))
end

#queue(name, opts) ⇒ Object



23
24
25
# File 'lib/liebre/adapter/bunny/chan.rb', line 23

def queue name, opts
  Queue.new(channel.queue(name, opts))
end

#set_prefetch(count) ⇒ Object



27
28
29
# File 'lib/liebre/adapter/bunny/chan.rb', line 27

def set_prefetch count
  channel.basic_qos(count, false)
end