Ejemplo n.º 1
0
 public function testTaskProcess()
 {
     $theValue = 123123;
     /** @var TaskWrapper $task */
     $task = new TaskWrapper(TestTask::class, ['result' => $theValue]);
     $resultValue = $task->process();
     $this->assertEquals($theValue, $resultValue);
 }
Ejemplo n.º 2
0
 /**
  * @param TaskWrapper $task
  *
  * @return Result
  * @throws Exception
  */
 public function process(TaskWrapper $task) : Result
 {
     $resultValue = null;
     $isTaskSucceed = false;
     try {
         $resultValue = $task->process();
         $isTaskSucceed = true;
     } catch (Exception $e) {
         throw $e;
     } finally {
         return new Result($task->getId(), $resultValue, $isTaskSucceed);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param TaskWrapper $task
  */
 protected function pushTask(TaskWrapper $task)
 {
     $this->getChannel()->basic_publish($task->getMessage(), '', $this->name);
 }