مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-19 22:29:47 +00:00
26 أسطر
587 B
Ruby
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
|