Sha256: 20f232f7103fb77f8c593a4c46eb16d7dd6b8a3e8b10993d5a560228800e4803
Contents?: true
Size: 962 Bytes
Versions: 3
Compression:
Stored size: 962 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, automatically_recover: RabbitCarrots.configuration.automatically_recover || true, network_recovery_interval: RabbitCarrots.configuration.network_recovery_interval || 5, recovery_attempts: RabbitCarrots.configuration.recovery_attempts || 5, recovery_attempts_exhausted: -> { Process.kill('TERM', Process.pid) } ) @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-1.0.2 | lib/rabbit_carrots/connection.rb |
rabbit_carrots-1.0.1 | lib/rabbit_carrots/connection.rb |
rabbit_carrots-1.0.0 | lib/rabbit_carrots/connection.rb |