PHP Class Scalr\System\Zmq\Cron\AbstractTask

Task queue boilerplate.
Since: 5.0.1 (10.09.2014)
Author: Vitaliy Demidov ([email protected])
Inheritance: implements Scalr\System\Zmq\Cron\TaskInterface, use trait Scalr\LoggerAwareTrait
Afficher le fichier Open project: scalr/scalr Class Usage Examples

Protected Properties

Свойство Type Description
$name string Task name
$queue ArrayObject Task queue

Méthodes publiques

Méthode Description
__construct ( ) Constructor
addWorker ( $address = null )
checkMemoryUsage ( )
config ( ) : object Gets config for this cron
getAuditLoggerConfig ( )
getName ( )
getReplicaAccounts ( ) : array Gets accounts to replicate a service to process its queue in the separate workers
getReplicaTypes ( string $name = 'type', string $regex = null ) : array Gets types to replicate a service to process its queue in the separate workers
getScalrService ( ) : ScalrService Gets Scalr service
isServiceRegistered ( string $serviceName = null ) : integer | boolean Checks whether service is registered with the broker
launch ( )
onCompleted ( )
onResponse ( Scalr\System\Zmq\Cron\AbstractPayload $payload )
run ( )
shutdown ( )

Méthodes protégées

Méthode Description
launchClient ( ) : integer Runs ZMQ MDP Asynchronous Client
launchWorkers ( string $address = null ) : integer It launches pool of workers

Private Methods

Méthode Description
_launchWorkers ( string $address = null, integer $workers = null ) : integer It launches pool of workers
terminateWorker ( integer $pid ) Terminates one worker by specified pid

Method Details

__construct() public méthode

Constructor
public __construct ( )

addWorker() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::addWorker()
public addWorker ( $address = null )

checkMemoryUsage() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::checkMemoryUsage()
public checkMemoryUsage ( )

config() public méthode

Gets config for this cron
public config ( ) : object
Résultat object Returns configuration options for the task

getAuditLoggerConfig() public méthode

See also: Scalr\LogCollector\AuditLoggerRetrieveConfigurationInterface::getAuditLoggerConfig()

getName() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::getName()
public getName ( )

getReplicaAccounts() public méthode

Gets accounts to replicate a service to process its queue in the separate workers
public getReplicaAccounts ( ) : array
Résultat array Returns the list of the accounts to replicate

getReplicaTypes() public méthode

Gets types to replicate a service to process its queue in the separate workers
public getReplicaTypes ( string $name = 'type', string $regex = null ) : array
$name string optional The name of the replica type in the config
$regex string optional Regex to validate. It should be specified without anchors and modifiers
Résultat array Returns the list of the types to replicate

getScalrService() public méthode

Gets Scalr service
public getScalrService ( ) : ScalrService
Résultat Scalr\Model\Entity\ScalrService Returns ScalrService instance for the current task

isServiceRegistered() public méthode

Checks whether service is registered with the broker
public isServiceRegistered ( string $serviceName = null ) : integer | boolean
$serviceName string optional The name of the service.
Résultat integer | boolean Returns the number of registered workers if service has been registered with the broker or boolean FALSE otherwise

launch() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::launch()
public launch ( )

launchClient() protected méthode

Runs ZMQ MDP Asynchronous Client
protected launchClient ( ) : integer
Résultat integer The number of launched workers

launchWorkers() protected méthode

It launches pool of workers
protected launchWorkers ( string $address = null ) : integer
$address string optional An address to override the service name
Résultat integer The number of launched workers

onCompleted() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::onCompleted()
public onCompleted ( )

onResponse() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::onResponse()
public onResponse ( Scalr\System\Zmq\Cron\AbstractPayload $payload )
$payload Scalr\System\Zmq\Cron\AbstractPayload

run() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::run()
public run ( )

shutdown() public méthode

See also: Scalr\System\Zmq\Cron\TaskInterface::shutdown()
public shutdown ( )

Property Details

$name protected_oe property

Task name
protected string $name
Résultat string

$queue protected_oe property

Task queue
protected ArrayObject $queue
Résultat ArrayObject