Sha256: 24869d2a6a5a7d7dd2b8b8699b0ae1228d6677c443688ab372b70fba4ddd9f16

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

require 'singleton'

module Outboxable
  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

2 entries across 2 versions & 1 rubygems

Version Path
outboxable-0.1.1 lib/outboxable/connection.rb
outboxable-0.1.0 lib/outboxable/connection.rb