module RabbitJobs::AmqpTransport
Connection manager.
Public Class Methods
amqp_cleanup()
click to toggle source
# File lib/rabbit_jobs/amqp_transport.rb, line 21 def amqp_cleanup conn = @amqp_connection @amqp_connection = nil conn.stop if conn && conn.status != :not_connected @consumer_channel.work_pool.join if @consumer_channel @publisher_channel = nil @consumer_channel = nil true end
amqp_connection()
click to toggle source
# File lib/rabbit_jobs/amqp_transport.rb, line 5 def amqp_connection @amqp_connection ||= Bunny.new( RabbitJobs.config.server, automatically_recover: false, properties: Bunny::Session::DEFAULT_CLIENT_PROPERTIES.merge(product: "rabbit_jobs #{Process.pid}") ).start end
consumer_channel()
click to toggle source
# File lib/rabbit_jobs/amqp_transport.rb, line 17 def consumer_channel @consumer_channel ||= amqp_connection.create_channel(1) end
publisher_channel()
click to toggle source
# File lib/rabbit_jobs/amqp_transport.rb, line 13 def publisher_channel @publisher_channel ||= amqp_connection.create_channel(2) end