The Warlock application service class
Services are long running processes that allow code to be executed on the server in the background without affecting or requiring any interaction with the front-end. Services are managed by the Warlock process and can be set to start when Warlock starts or enabled/disabled manually using the Hazaar\Warlock\Control class.
Services are executed within the Application context and therefore have access to everything (configs, classes/models, cache, etc) that your application front-end does.
See the "Services Documentation":https://scroly.io/hazaarmvc/advanced-features/warlock/services for information on how to write and manage services.
protected array $schedule
private int $lastHeartbeat
private int $lastCheckfile
private string $serviceFile
private int $serviceFileMtime
private array $__logLevels
private string $__logFile
private int $__localLogLevel = 'W_INFO'
public __construct(Application $application, Protocol $protocol, bool $remote = false): void
Parameter | Type | Description |
---|
$application | Application | |
$protocol | Protocol | |
$remote | bool | |
public __destruct(): void
public __errorHandler(int $errno, string $errstr, ?string $errfile, ?int $errline, array $errcontext = []): bool
Parameter | Type | Description |
---|
$errno | int | |
$errstr | string | |
$errfile | string | |
$errline | int | |
$errcontext | array | |
public __exceptionHandler(\Throwable $e): bool
Parameter | Type | Description |
---|
$e | \Throwable | |
protected __processCommand(string $command, mixed $payload): bool
Parameter | Type | Description |
---|
$command | string | |
$payload | mixed | |
private __processSchedule(): void
protected __sendHeartbeat(): void
private __stateString(?int $state): string
Parameter | Type | Description |
---|
$state | int | |
private __rotateLogFiles(int $logfiles = 0): void
Parameter | Type | Description |
---|
$logfiles | int | |
public log(int $level, mixed $message, ?string $name): bool
Parameter | Type | Description |
---|
$level | int | |
$message | mixed | |
$name | string | |
public debug(mixed $data, ?string $name): bool
Parameter | Type | Description |
---|
$data | mixed | |
$name | string | |
public main(?array $params, bool $dynamic = false): int
Parameter | Type | Description |
---|
$params | array | |
$dynamic | bool | |
public delay(int $seconds, string $callback, array $arguments = []): string
Parameter | Type | Description |
---|
$seconds | int | |
$callback | string | |
$arguments | array | |
public interval(int $seconds, string $callback, array $params = [], ?string $tag, bool $overwrite = false): string
Parameter | Type | Description |
---|
$seconds | int | |
$callback | string | |
$params | array | |
$tag | string | |
$overwrite | bool | |
public schedule(DateTime $date, string $callback, array $params = [], ?string $tag, bool $overwrite = false): string
Parameter | Type | Description |
---|
$date | DateTime | |
$callback | string | |
$params | array | |
$tag | string | |
$overwrite | bool | |
public cron(string $format, string $callback, ?array $arguments): string
Parameter | Type | Description |
---|
$format | string | |
$callback | string | |
$arguments | array | |
public cancel(string $id): bool
Parameter | Type | Description |
---|
$id | string | |
public signal(string $eventID, mixed $data): bool
Parameter | Type | Description |
---|
$eventID | string | |
$data | mixed | |
public send(string $command, mixed $payload): bool
Parameter | Type | Description |
---|
$command | string | |
$payload | mixed | |
public recv(mixed $payload, int $tv_sec = 3, int $tv_usec = 0): string
Parameter | Type | Description |
---|
$payload | mixed | |
$tv_sec | int | |
$tv_usec | int | |
protected connect(Protocol $protocol, ?string $guid): false
Parameter | Type | Description |
---|
$protocol | Protocol | |
$guid | string | |
protected sleep(int $timeout = 0): bool
Parameter | Type | Description |
---|
$timeout | int | |
private invokeMethod(string $method, ?array $arguments): mixed
Parameter | Type | Description |
---|
$method | string | |
$arguments | array | |
Generated by Hazaar API Doc Generator