Class: BunnyBurrow::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/data_collector/ext/base.rb

Overview

class Connection

include Singleton
attr_reader :connection
attr_accessor :verify_peer, :connection_name, :rabbitmq_url

def connection
  unless @connection
    @connection = Bunny.new(@rabbitmq_url, verify_peer: @verify_peer, connection_name: @connection_name)
    @connection.start
  end

  @connection.start unless @connection.connected? || @connection.closed?
  #@connection.start if @connection.closed?

  #pp @connection.status

  @connection
end

def channel
  @channel = connection.create_channel unless @channel && @channel.open?

  @channel
end

end

Instance Attribute Summary collapse

Instance Attribute Details

#connection_nameObject

Returns the value of attribute connection_name.



32
33
34
# File 'lib/data_collector/ext/base.rb', line 32

def connection_name
  @connection_name
end