Sha256: 36f700ad2ae52fd58de3ff31d2abedb6a8d1728db153da8cc11167681721ec39
Contents?: true
Size: 769 Bytes
Versions: 1
Compression:
Stored size: 769 Bytes
Contents
# Monkey patching some methods into AMQP to make it more testable module AMQP # Initializes new AMQP client/connection without starting another EM loop def self.start_connection(opts={}, &block) self.connection = connect opts, &block end # Closes AMQP connection gracefully def self.stop_connection if AMQP.connection and not AMQP.connection.closing? @closing = true self.connection.close { yield if block_given? self.connection = nil cleanup_state } end end # Cleans up AMQP state after AMQP connection closes def self.cleanup_state Thread.list.each { |thread| thread[:mq] = nil } Thread.list.each { |thread| thread[:mq_id] = nil } self.connection = nil @closing = false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
evented-spec-0.4.0 | lib/evented-spec/amqp.rb |