Class: MKIt::ServiceWorker

Inherits:
AWorker
  • Object
show all
Defined in:
lib/mkit/workers/service_worker.rb

Instance Method Summary collapse

Methods inherited from AWorker

#initialize

Constructor Details

This class inherits a constructor from MKIt::AWorker

Instance Method Details

#do_the(job) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mkit/workers/service_worker.rb', line 8

def do_the(job)
  MKItLogger.info("#{self.class} <#{job.topic}> job #{job.inspect}....")
  srv = Service.find(job.service_id)
  case job.topic.to_sym
  when :start_service
    srv.start
  when :stop_service
    srv.stop
  when :update_service
    MKItLogger.info("#{self.class} <#{job.topic}> <<TODO>> job #{job.inspect}....")
  when :delete_service
    Service.destroy(job.service_id)
  else
    MKItLogger.info("#{self.class} <#{job.topic}> <<TODO>> job #{job.inspect}....")
  end
end

#topicsObject



4
5
6
# File 'lib/mkit/workers/service_worker.rb', line 4

def topics
  %w{start_service stop_service update_service delete_service}
end