Module: RabbitJobs::AmqpTransport
- Defined in:
- lib/rabbit_jobs/amqp_transport.rb
Overview
Connection manager.
Class Method Summary collapse
- .amqp_cleanup ⇒ Object
- .amqp_connection ⇒ Object
- .consumer_channel ⇒ Object
- .publisher_channel ⇒ Object
Class Method Details
.amqp_cleanup ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# 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 ⇒ Object
5 6 7 8 9 10 11 |
# 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 ⇒ Object
17 18 19 |
# File 'lib/rabbit_jobs/amqp_transport.rb', line 17 def consumer_channel @consumer_channel ||= amqp_connection.create_channel(1) end |
.publisher_channel ⇒ Object
13 14 15 |
# File 'lib/rabbit_jobs/amqp_transport.rb', line 13 def publisher_channel @publisher_channel ||= amqp_connection.create_channel(2) end |