Module: Promiscuous::AMQP
- Extended by:
- Autoload
- Defined in:
- lib/promiscuous/amqp.rb
Defined Under Namespace
Classes: Bunny, Fake, File, HotBunnies, Null
Constant Summary
collapse
- LIVE_EXCHANGE =
'promiscuous'
Class Attribute Summary collapse
Class Method Summary
collapse
Methods included from Autoload
autoload
Class Attribute Details
.backend ⇒ Object
Returns the value of attribute backend.
8
9
10
|
# File 'lib/promiscuous/amqp.rb', line 8
def backend
@backend
end
|
.backend_class ⇒ Object
Returns the value of attribute backend_class.
9
10
11
|
# File 'lib/promiscuous/amqp.rb', line 9
def backend_class
@backend_class
end
|
Class Method Details
.connect ⇒ Object
26
27
28
29
30
|
# File 'lib/promiscuous/amqp.rb', line 26
def connect
return if @backend
@backend = backend_class.new
@backend.connect
end
|
.const_missing(sym) ⇒ Object
46
47
48
|
# File 'lib/promiscuous/amqp.rb', line 46
def const_missing(sym)
backend_class.const_get(sym)
end
|
.disconnect ⇒ Object
32
33
34
35
36
37
|
# File 'lib/promiscuous/amqp.rb', line 32
def disconnect
return unless @backend
@backend.disconnect
@backend.terminate if @backend.respond_to?(:terminate)
@backend = nil
end
|
.ensure_connected ⇒ Object
20
21
22
23
24
|
# File 'lib/promiscuous/amqp.rb', line 20
def ensure_connected
Promiscuous.ensure_connected
raise lost_connection_exception unless connected?
end
|
.lost_connection_exception(options = {}) ⇒ Object
.new_connection(*args) ⇒ Object
39
40
41
42
|
# File 'lib/promiscuous/amqp.rb', line 39
def new_connection(*args)
ensure_connected
backend.new_connection(*args)
end
|