Method: Babs::Client#initialize

Defined in:
lib/babs/client.rb

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/babs/client.rb', line 13

def initialize(options = {})
  # make this connection part a singleton and a LOT of time is saved, as well as reusing the same connection
  @conn = Bunny.new(:automatically_recover => false)
  @conn.start
  @ch   = @conn.create_channel

  @defaults = Hashie::Mash.new({
      server_queue: nil,
      exchange: @ch.default_exchange
    }.merge(options)
  )

  @lock      = Mutex.new
  @condition = ConditionVariable.new

end