\Hazaar\Warlock
Service
Abstract
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 for information on how to write and manage services.

Tags

Since

2.0.0

Module

warlock

Summary
Methods Properties Constants
run
No constants
Properties
$application
$application
$config
$config
$lastHeartbeat
$lastHeartbeat
$name
$name
$next
$next
$options
$options
$protocol
$protocol
$schedule
$schedule
$slept
$slept
$start
$start
$state
$state
$subscriptions
$subscriptions
Methods
__construct()
__construct($application, $protocol = null)

Parameters

$application

No description

$protocol

No description

cancel()
cancel($id)

Parameters

$id

No description

cron()
cron($format, $callback, $params = Array ( ) )

Parameters

$format

No description

$callback

No description

$params

No description

delay()
delay($seconds, $callback, $params = Array ( ) )

Parameters

$seconds

No description

$callback

No description

$params

No description

init()
init()
interval()
interval($seconds, $callback, $params = Array ( ) )

Parameters

$seconds

No description

$callback

No description

$params

No description

main()
main()
processCommand()
processCommand($command, $payload = null)

Parameters

$command

No description

$payload

No description

processSchedule()
processSchedule()
restart()
restart()
run()
run()
schedule()
schedule($date, $callback, $params = Array ( ) )

Parameters

$date

No description

$callback

No description

$params

No description

send()
send($command, $payload = null)

Parameters

$command

No description

$payload

No description

sendHeartbeat()
sendHeartbeat()
setErrorHandler()
setErrorHandler($methodName)

Parameters

$methodName

No description

setExceptionHandler()
setExceptionHandler($methodName)

Parameters

$methodName

No description

shutdown()
shutdown()
sleep()
sleep($timeout = 0)
Sleep for a number of seconds. If data is received during the sleep it is processed. If the timeout is greater

than zero and data is received, the remaining timeout amount will be used in subsequent selects to ensure the full sleep period is used. If the timeout parameter is not set then the loop will just dump out after one execution.

Parameters

$timeoutint

No description

start()
start()
state()
state()
stateString()
stateString($state = null)

Parameters

$state

No description

stop()
stop()
subscribe()
subscribe($event, $callback, $filter = null)

Parameters

$event

No description

$callback

No description

$filter

No description

trigger()
trigger($event, $payload)

Parameters

$event

No description

$payload

No description

unsubscribe()
unsubscribe($event)

Parameters

$event

No description