Class: Banter::Server::SubscriberServer

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/banter/server/subscriber_server.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#banter_worker_idObject (readonly)

Returns the value of attribute banter_worker_id.



20
21
22
# File 'lib/banter/server/subscriber_server.rb', line 20

def banter_worker_id
  @banter_worker_id
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



20
21
22
# File 'lib/banter/server/subscriber_server.rb', line 20

def hostname
  @hostname
end

#pidObject (readonly)

Returns the value of attribute pid.



20
21
22
# File 'lib/banter/server/subscriber_server.rb', line 20

def pid
  @pid
end

#process_nameObject (readonly)

Returns the value of attribute process_name.



20
21
22
# File 'lib/banter/server/subscriber_server.rb', line 20

def process_name
  @process_name
end

#workersObject (readonly)

Returns the value of attribute workers.



20
21
22
# File 'lib/banter/server/subscriber_server.rb', line 20

def workers
  @workers
end

Class Method Details

.instanceObject



22
23
24
# File 'lib/banter/server/subscriber_server.rb', line 22

def self.instance
  @instance ||= new
end

Instance Method Details

#register_workersObject



40
41
42
43
# File 'lib/banter/server/subscriber_server.rb', line 40

def register_workers
  return unless Banter::Configuration.web_enabled
  BanterWorker.worker_started
end

#set_workers(subscribers) ⇒ Object



26
27
28
# File 'lib/banter/server/subscriber_server.rb', line 26

def set_workers(subscribers)
  @workers = subscribers.map { |subscriber| create_queue_listeners(subscriber) }
end

#startObject



30
31
32
33
34
35
36
37
38
# File 'lib/banter/server/subscriber_server.rb', line 30

def start
  set_information
  register_workers
  start_workers
  handle_interrupts
  handle_teardown
ensure
  stop_worker
end