Esempio n. 1
0
 /**
  * Implementation of jqworker:listen
  */
 public static function listen()
 {
     $options = static::parse_options();
     $listener = new Listener(Context::instance(), getcwd());
     $listener->listen($options['connection'], $options['queue'], $options['delay'], $options['memory'], $options['timeout']);
 }
Esempio n. 2
0
 /**
  * Create a new Process for the worker.
  *
  * @param  string  $connection
  * @param  string  $queue
  * @param  int     $delay
  * @param  int     $memory
  * @param  int     $timeout
  * @return \Symfony\Component\Process\Process
  */
 public function make_process($connection, $queue, $delay, $memory, $timeout)
 {
     // 6th argument: $sleep = true
     $command = $this->context->create_work_task_command($connection, $queue, $delay, $memory, $timeout, true);
     return new Process($command, $this->command_path, null, null, $timeout);
 }
Esempio n. 3
0
 /**
  * Get the name of the default queue connection.
  *
  * @return string
  */
 protected function get_default()
 {
     return $this->context->get_default_connection();
 }
Esempio n. 4
0
 /**
  * Resolve the given job handler.
  *
  * @param  string  $class
  * @return mixed
  */
 protected function resolve($class)
 {
     return $this->context->make_job_handler($class);
 }