Class: Jackhammer::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/jackhammer/server.rb

Class Method Summary collapse

Class Method Details

.configureObject



3
4
5
6
7
8
# File 'lib/jackhammer/server.rb', line 3

def self.configure
  Jackhammer.configure do |config|
    yield config
    config.server = self
  end
end

.startObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jackhammer/server.rb', line 10

def self.start
  running = true
  Signal.trap('INT') do
    print "\n\nstopping...\n"
    running = false
  end
  Jackhammer.topics.each { |_name, topic| topic.subscribe_queues }
  Log.info 'Topic queues subscribed and listening... Send INT signal to stop.'
  sleep 2 while running
  Jackhammer.connection.close
end