Class: Ragnar::Connector
- Inherits:
-
Object
- Object
- Ragnar::Connector
- Defined in:
- lib/ragnar/connector.rb
Class Attribute Summary collapse
-
.connection ⇒ Object
Store the connection for later retrieval.
Class Method Summary collapse
-
.connect(opts = {}) ⇒ Object
Pass connection options through to AMQP.
- .connected? ⇒ Boolean
Class Attribute Details
.connection ⇒ Object
Store the connection for later retrieval
10 11 12 |
# File 'lib/ragnar/connector.rb', line 10 def connection @connection end |
Class Method Details
.connect(opts = {}) ⇒ Object
Pass connection options through to AMQP
13 14 15 16 17 18 19 |
# File 'lib/ragnar/connector.rb', line 13 def connect opts={} unless EM.reactor_running? Thread.new { EventMachine.run } sleep 0.5 end @connection = AMQP.connect(opts) end |
.connected? ⇒ Boolean
21 22 23 |
# File 'lib/ragnar/connector.rb', line 21 def connected? @connection && @connection.connected? end |