1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-19 22:29:47 +00:00
الملفات
postal/lib/postal/rabbit_mq.rb
2017-04-19 13:07:25 +01:00

26 أسطر
587 B
Ruby

require 'postal/config'
require 'bunny'
module Postal
module RabbitMQ
def self.create_connection
conn = Bunny.new(
:host => Postal.config.rabbitmq&.host || 'localhost',
:port => Postal.config.rabbitmq&.port || 5672,
:username => Postal.config.rabbitmq&.username || 'guest',
:password => Postal.config.rabbitmq&.password || 'guest',
:vhost => Postal.config.rabbitmq&.vhost || nil
)
conn.start
conn
end
def self.create_channel
conn = self.create_connection
conn.create_channel
end
end
end