Class: Kanina::Server
- Inherits:
-
Object
- Object
- Kanina::Server
- Extended by:
- Logger
- Defined in:
- lib/kanina/server.rb
Overview
Kanina::Server
loads configuration, opens a connection to RabbitMQ
and opens a channel so messages can be received and sent. This class is
automatically called and handled by a Railtie, so you shouldn't have to
invoke it by hand.
Constant Summary
Constants included from Logger
Class Attribute Summary collapse
-
.channel ⇒ Object
readonly
Returns the value of attribute channel.
-
.config ⇒ Object
Returns the value of attribute config.
-
.connection ⇒ Object
readonly
Returns the value of attribute connection.
-
.loud ⇒ Object
Returns the value of attribute loud.
Class Method Summary collapse
-
.start ⇒ String
Loads the configuration, opens a connection, and opens the channel.
-
.status ⇒ String
Returns the current status of the server connection.
-
.stop ⇒ String
Closes the connection to RabbitMQ.
Methods included from Logger
Class Attribute Details
.channel ⇒ Object (readonly)
Returns the value of attribute channel.
10 11 12 |
# File 'lib/kanina/server.rb', line 10 def channel @channel end |
.config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/kanina/server.rb', line 11 def config @config end |
.connection ⇒ Object (readonly)
Returns the value of attribute connection.
10 11 12 |
# File 'lib/kanina/server.rb', line 10 def connection @connection end |
.loud ⇒ Object
Returns the value of attribute loud.
11 12 13 |
# File 'lib/kanina/server.rb', line 11 def loud @loud end |
Class Method Details
.start ⇒ String
Loads the configuration, opens a connection, and opens the channel. This will automatically be run in the railtie when you install Kanina into a Rails project, so you shouldn't have to run it yourself.
23 24 25 26 27 28 29 |
# File 'lib/kanina/server.rb', line 23 def start set_status 'starting' load_config unless @config.present? open_connection open_channel set_status 'started' end |
.status ⇒ String
Returns the current status of the server connection.
15 16 17 |
# File 'lib/kanina/server.rb', line 15 def status @status || 'off' end |
.stop ⇒ String
Closes the connection to RabbitMQ.
33 34 35 36 |
# File 'lib/kanina/server.rb', line 33 def stop set_status 'stopping' cleanup end |