/** * @param \PHPQueue\Job $jobObject */ public function runJob($jobObject) { parent::runJob($jobObject); $jobQueue = \PHPQueue\Base::getQueue('Generic'); $jobQueue->resultLog->addInfo('Working job: ', $jobObject->data); $this->result_data = array_merge($jobObject->data, array('status' => 'success')); }
public static function addJob($workers = array(), $payload = array(), $queue = 'Generic') { $queue = \PHPQueue\Base::getQueue($queue); $jobData = array_merge(array('worker' => $workers), $payload); $queue->addJob($jobData); return true; }
protected function processWorker($worker_name, $new_job) { fwrite(STDOUT, sprintf("Running worker (%s) now... ", $worker_name)); $newWorker = \PHPQueue\Base::getWorker($worker_name); \PHPQueue\Base::workJob($newWorker, $new_job); fwrite(STDOUT, "Done.\n"); return $newWorker->result_data; }
public function __construct() { parent::__construct(); $config_class = \PHPQueue\Base::$config_class; $config = $config_class::getConfig($this->queue_type); $this->dataSource = \PHPQueue\Base::backendFactory($config['backend'], $config); $this->resultLog = \PHPQueue\Logger::createLogger('MainLogger', \PHPQueue\Logger::INFO, sprintf('%s/QueueLog-%s-%s.log', $config_class::getLogRoot(), $this->queue_type, date('Ymd'))); }
protected function processWorker($worker_name, $new_job) { $newWorker = \PHPQueue\Base::getWorker($worker_name); \PHPQueue\Base::workJob($newWorker, $new_job); return $newWorker->result_data; }
public function __construct() { $this->dataSource = \PHPQueue\Base::backendFactory('Beanstalkd', $this->sourceConfig); $this->resultLog = \PHPQueue\Logger::createLogger('BeanstalkSampleLogger', PHPQueue\Logger::INFO, __DIR__ . '/logs/results.log'); }
/** * @return \PHPQueue\Backend\Base */ private function getDataSource() { $config_class = \PHPQueue\Base::$config_class; Console::stdout('Connecting to DataSource...'); $config = $config_class::getConfig($this->queue); $ds = \PHPQueue\Base::backendFactory($config['backend'], $config); Console::output('%g[OK]%n'); return $ds; }
public function setUp() { parent::setUp(); $this->object = \PHPQueue\Base::getWorker('Sample'); }
protected function processWorker($worker_name, $new_job) { $this->logger->addInfo(sprintf("Running new job (%s) with worker: %s", $new_job->job_id, $worker_name)); $worker = \PHPQueue\Base::getWorker($worker_name); \PHPQueue\Base::workJob($worker, $new_job); $this->logger->addInfo(sprintf('Worker is done. Updating job (%s). Result:', $new_job->job_id), $worker->result_data); return $worker->result_data; }