The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XAS::Supervisor::Controller - manage multiple processes

SYNOPSIS

 use XAS::Supervisor::Controller;

 my $controller = XAS::Supervisor::Controller->new(
    -alias     => 'controller',
    -port      => '9506',
    -address   => '127.0.0.1,
    -processes => $processes
 );

 $controller->run;

DESCRIPTION

This module provides a RPC interface to the supervisor. This interface allows external access to stop, start, pause, resume and kill processes. It also provides a means to to retrieve the status of a process and to list all the known processes.

METHODS

new

This module inherits from XAS::Lib::RPC::JSON::Server and takes all of the same parameters.

session_initialize

This method sets up the process for the rpc calls.

check_status

This method starts a background task to check the status of RPC calls.

RPC CALLS

The following rpc calls are supported. XAS::Supervisor::Client has this interface already defined and should be used when writting new code.

start_process

This will start a process. The rpc parameters should use 'name' with the processes name. If the start was successful, "running" will be returned.

stop_process

This will stop a process. The rpc parameters should use 'name' with the processes name. If the stop was successful, "stopped" will be returned.

pause_process

This will pause a process. The rpc parameters should use 'name' with the processes name. If the pause was successful, "paused" will be returned.

resume_process

This will resume a process. The rpc parameters should use 'name' with the processes name. If the resume was successful, "running" will be returned.

kill_process

This will kill a process. The rpc parameters should use 'name' with the processes name. If the kill was successful, "killed" will be returned.

stat_process

This will perform an OS level stat on the process. The rpc parameters should use 'name' with the processes name. It will return one of the following.

 'suspended ready'
 'suspended blocked'
 'blocked'
 'running'
 'ready'
 'other'
 'unknown'

list_process

This will return a list of all the processes that the supervisor knows of.

SEE ALSO

XAS::Supervisor::Client
XAS::Supervisor::Monitor
XAS::Supervisor
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2015 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.