mirror of
https://github.com/ditkrg/outboxable.git
synced 2026-01-23 22:36:46 +00:00
27 lines
616 B
Ruby
27 lines
616 B
Ruby
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
|