/** * {@inheritdoc} * @see \Scalr\System\Zmq\Cron\AbstractTask::config() */ public function config() { $config = parent::config(); if ($config->daemon) { //Report a warning to the log trigger_error(sprintf("Demonized mode is not allowed for '%s' task. Forcing normal mode.", $this->name), E_USER_WARNING); //Forces normal mode $config->daemon = false; } return $config; }
/** * {@inheritdoc} * @see \Scalr\System\Zmq\Cron\AbstractTask::config() */ public function config() { $config = parent::config(); if ($config->daemon) { //Report a warning to log trigger_error(sprintf("Demonized mode is not allowed for '%s' job.", $this->name), E_USER_WARNING); //Forces normal mode $config->daemon = false; } if ($config->workers != 1) { //It cannot be performed through ZMQ MDP as execution time exceeds heartbeat trigger_error(sprintf("It is allowed only one worker for the '%s' job.", $this->name), E_USER_WARNING); $config->workers = 1; } return $config; }
/** * Constructor */ public function __construct() { parent::__construct(); $this->db = \Scalr::getDb(); }
/** * {@inheritdoc} * @see \Scalr\System\Zmq\Cron\AbstractTask::launchWorkers() */ protected function launchWorkers($address = null) { $config = $this->config(); //It launches different pools of workers according to replication schema defined in the config foreach (array_merge(!empty($config->replicate['type']) ? $config->replicate['type'] : [], ['all']) as $type) { if (!empty($config->replicate['account'])) { foreach ($config->replicate['account'] as $acc) { parent::launchWorkers($this->name . '.' . $type . '.' . $acc); } } parent::launchWorkers($this->name . '.' . $type . '.all'); } }
/** * Constructor */ public function __construct() { parent::__construct(); $this->db = \Scalr::getDb(); $this->serializer = new Scalr_Messaging_XmlSerializer(); $this->jsonSerializer = new Scalr_Messaging_JsonSerializer(); }