NAME

Ubic::Service::Common - common way to construct new service by specifying several callbacks

VERSION

version 1.13

SYNOPSIS

$service = Ubic::Service::Common->new({
    start => sub {
        # implementation-specific
    },
    stop => sub {
        # implementation-specific
    },
    status => sub {
        # implementation-specific
    },
    name => "yandex-ppb-something",
    port => 1234,
});
$service->start;

DESCRIPTION

Each service should provide safe start(), stop() and status() methods.

CONSTRUCTOR

Ubic::Service::Common->new($params)

Construct service object.

Possible parameters:

start

Mandatory sub reference providing service start mechanism.

stop

The same for stop.

status

Mandatory sub reference checking if service is alive.

It should return one of running, not running, broken values.

This code will be used as safety check against double start and as a watchdog.

name

Service's name.

port

Service's port.

AUTHOR

Vyacheslav Matjukhin <mmcleric@yandex-team.ru>