Module: Async::Service::Supervisor::Environment

Includes:
Managed::Environment
Defined in:
lib/async/service/supervisor/environment.rb

Overview

An environment mixin for supervisor services.

Provides configuration and setup for supervisor processes that monitor workers.

Instance Method Summary collapse

Instance Method Details

#container_optionsObject

Options to use when creating the container. Merges with Managed::Environment defaults.



53
54
55
# File 'lib/async/service/supervisor/environment.rb', line 53

def container_options
	super.merge(restart: true, count: self.count)
end

#countObject

Number of supervisor instances (always 1).



47
48
49
# File 'lib/async/service/supervisor/environment.rb', line 47

def count
	1
end

#endpointObject

The endpoint the supervisor will bind to.



41
42
43
# File 'lib/async/service/supervisor/environment.rb', line 41

def endpoint
	::IO::Endpoint.unix(ipc_path)
end

#ipc_pathObject

The IPC path to use for communication with the supervisor.



35
36
37
# File 'lib/async/service/supervisor/environment.rb', line 35

def ipc_path
	::File.expand_path("supervisor.ipc", root)
end

#make_server(endpoint) ⇒ Object

Create the supervisor server instance.



69
70
71
# File 'lib/async/service/supervisor/environment.rb', line 69

def make_server(endpoint)
	Server.new(endpoint: endpoint, monitors: self.monitors)
end

#monitorsObject

Get the list of monitors to run in the supervisor.

Override this method to provide custom monitors.



62
63
64
# File 'lib/async/service/supervisor/environment.rb', line 62

def monitors
	[]
end

#nameObject

The name of the supervisor



29
30
31
# File 'lib/async/service/supervisor/environment.rb', line 29

def name
	"supervisor"
end

#service_classObject

The service class to use for the supervisor.



23
24
25
# File 'lib/async/service/supervisor/environment.rb', line 23

def service_class
	Supervisor::Service
end