Sha256: a2f40f6b3a04a97c8a018ee5eb5439be40692a1421ccb71b28fd438257d7fda9

Contents?: true

Size: 601 Bytes

Versions: 13

Compression:

Stored size: 601 Bytes

Contents

require 'singleton'

module Outboxable
  class Connection
    include ::Singleton
    attr_reader :connection

    def initialize
      @connection = Bunny.new(
        host: Outboxable.configuration.rabbitmq_host,
        port: Outboxable.configuration.rabbitmq_port,
        user: Outboxable.configuration.rabbitmq_user,
        password: Outboxable.configuration.rabbitmq_password,
        vhost: Outboxable.configuration.rabbitmq_vhost
      )

      @connection.start
    end

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
outboxable-1.0.6 lib/outboxable/connection.rb
outboxable-1.0.5 lib/outboxable/connection.rb
outboxable-1.0.4 lib/outboxable/connection.rb
outboxable-1.0.3 lib/outboxable/connection.rb
outboxable-1.0.2 lib/outboxable/connection.rb
outboxable-1.0.0 lib/outboxable/connection.rb
outboxable-0.1.8 lib/outboxable/connection.rb
outboxable-0.1.7 lib/outboxable/connection.rb
outboxable-0.1.6 lib/outboxable/connection.rb
outboxable-0.1.5 lib/outboxable/connection.rb
outboxable-0.1.4 lib/outboxable/connection.rb
outboxable-0.1.3 lib/outboxable/connection.rb
outboxable-0.1.2 lib/outboxable/connection.rb