Sha256: de096ad081507882050fbcf3ce9ef61b300522339bf36529a9125c0bd6da7f6e

Contents?: true

Size: 625 Bytes

Versions: 3

Compression:

Stored size: 625 Bytes

Contents

require 'singleton'

module RabbitCarrots
  class Connection
    include ::Singleton
    attr_reader :connection
  
    def initialize
      @connection = Bunny.new(
        host: RabbitCarrots.configuration.rabbitmq_host,
        port: RabbitCarrots.configuration.rabbitmq_port,
        user: RabbitCarrots.configuration.rabbitmq_user,
        password: RabbitCarrots.configuration.rabbitmq_password,
        vhost: RabbitCarrots.configuration.rabbitmq_vhost
      )

      @connection.start
    end
  
    def channel
      @channel ||= ConnectionPool.new do
        connection.create_channel
      end
    end
  end  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rabbit_carrots-0.1.14 lib/rabbit_carrots/connection.rb
rabbit_carrots-0.1.13 lib/rabbit_carrots/connection.rb
rabbit_carrots-0.1.12 lib/rabbit_carrots/connection.rb