Class: Kanina::Server

Inherits:
Object
  • Object
show all
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

Logger::DEFAULT_LOG_LEVEL

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Logger

logger, say

Class Attribute Details

.channelObject (readonly)

Returns the value of attribute channel


10
11
12
# File 'lib/kanina/server.rb', line 10

def channel
  @channel
end

.configObject

Returns the value of attribute config


11
12
13
# File 'lib/kanina/server.rb', line 11

def config
  @config
end

.connectionObject (readonly)

Returns the value of attribute connection


10
11
12
# File 'lib/kanina/server.rb', line 10

def connection
  @connection
end

.loudObject

Returns the value of attribute loud


11
12
13
# File 'lib/kanina/server.rb', line 11

def loud
  @loud
end

Class Method Details

.startObject


17
18
19
20
21
22
23
# File 'lib/kanina/server.rb', line 17

def start
  set_status 'starting'
  load_config unless @config.present?
  open_connection
  open_channel
  set_status 'started'
end

.statusObject


13
14
15
# File 'lib/kanina/server.rb', line 13

def status
  @status || 'off'
end

.stopObject


25
26
27
28
# File 'lib/kanina/server.rb', line 25

def stop
  set_status 'stopping'
  cleanup
end