Esempio n. 1
0
 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')));
 }
Esempio n. 2
0
 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 = Base::getWorker($worker_name);
     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;
 }
Esempio n. 3
0
 public function setup()
 {
     if (empty($this->log_path)) {
         $baseFolder = dirname(dirname(__DIR__));
         $this->log_path = sprintf('%s/demo/runners/logs/', $baseFolder);
     }
     $logFileName = sprintf('%s-%s.log', $this->queue_name, date('Ymd'));
     $this->logger = \PHPQueue\Logger::createLogger($this->queue_name, $this->log_level, $this->log_path . $logFileName);
 }
 public function __construct()
 {
     $this->dataSource = \PHPQueue\Base::backendFactory('Beanstalkd', $this->sourceConfig);
     $this->resultLog = \PHPQueue\Logger::createLogger('BeanstalkSampleLogger', PHPQueue\Logger::INFO, __DIR__ . '/logs/results.log');
 }
Esempio n. 5
0
 protected function createLogger()
 {
     $this->logger = Logger::createLogger($this->queue_name, $this->log_level, $this->getFullLogPath());
 }