Sha256: f443b215ffb443a71ef70894ada8a278b82bd18cdece6a05eba0d1bc44e001c9
Contents?: true
Size: 788 Bytes
Versions: 1
Compression:
Stored size: 788 Bytes
Contents
require 'mq' module AMQP # Initializes new AMQP client/connection without starting another EM loop def self.start_connection(opts={}, &block) # puts "!!!!!!!!! Existing connection: #{@conn}" if @conn @conn = connect opts @conn.callback(&block) if block end # Closes AMQP connection gracefully def self.stop_connection if AMQP.conn and not AMQP.closing # MQ.reset ? @closing = true @conn.close { yield if block_given? cleanup_state } end end # Cleans up AMQP state after AMQP connection closes def self.cleanup_state # MQ.reset ? Thread.list.each {|thread| thread[:mq] = nil } Thread.list.each {|thread| thread[:mq_id] = nil } @conn = nil @closing = false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amqp-spec-0.2.7 | lib/amqp-spec/amqp.rb |