Sha256: 69d1b8a958da3ecf6613457f4108630a4e9537098dfa2b4db61e68ad4b8a78c8
Contents?: true
Size: 749 Bytes
Versions: 4
Compression:
Stored size: 749 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.current[:mq] = nil Thread.current[:mq_id] = nil @conn = nil @closing = false end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
amqp-spec-0.2.6 | lib/amqp-spec/amqp.rb |
amqp-spec-0.2.5 | lib/amqp-spec/amqp.rb |
amqp-spec-0.2.4 | lib/amqp-spec/amqp.rb |
amqp-spec-0.2.3 | lib/amqp-spec/amqp.rb |