Class: RubySupervisor::Client

Inherits:
Object
  • Object
show all
Includes:
GlobalAPI, ProcessAPI, ProcessGroupAPI
Defined in:
lib/ruby-supervisor/api.rb

Overview

Main class, one client is connected to one supervisor instance.

Constant Summary

Constants included from GlobalAPI

GlobalAPI::STATE_TO_STR

Instance Method Summary collapse

Methods included from GlobalAPI

#api_version, #clear_log, #clear_processes_logs, #identification, #pid, #processes, #read_log, #restart, #send_remote_comm_event, #shutdown, #start_processes, #state, #stop_processes, #version

Methods included from ProcessGroupAPI

#group

Methods included from ProcessAPI

#process

Constructor Details

#initialize(address = '127.0.0.1', port = 9001, params = {}) ⇒ Client

Returns a new instance of Client.



24
25
26
27
28
29
30
31
32
# File 'lib/ruby-supervisor/api.rb', line 24

def initialize(address = '127.0.0.1', port = 9001, params = {})      
  params = params.merge(
      :host => address,
      :port => port
    )
  
  @xmlrpc_client = XMLRPC::Client.new3(params)
  check_api_version()
end

Instance Method Details

#check_api_versionObject

Check that the API version is supported.



37
38
39
40
41
42
# File 'lib/ruby-supervisor/api.rb', line 37

def check_api_version
  v = api_version()
  if v != "3.0"
    raise "unsupported API: #{v}"
  end
end