public function run($taskId, $operation, array $arguments)
    {

        try {

            $lambda = new Lambda($operation, $this->ioc);

            if ($lambda->isInstanceMethod()) {
                $this->connectHooks($taskId, $lambda->getCallInstance());
            }

            $this->taskRepository->write($taskId, ['state' => Queue::RUNNING]);

            $result = $this->performTask($lambda, $arguments);

            $this->taskRepository->write($taskId, ['state' => Queue::FINISHED]);

            return $result;

        } catch (\Exception $e) {

            $this->taskRepository->writeMessage($taskId, $this->exceptionMessage($e), Chatty::FATAL);
            $this->taskRepository->write($taskId, ['state' => Queue::FAILED]);

        }

    }
public function run($taskId, $operation, array $arguments)
    {

        try {

            $lambda = new Lambda($operation, $this->ioc);

            if ($lambda->isInstanceMethod()) {
                $this->connectHooks($taskId, $lambda->getCallInstance());
            }

            $this->taskRepository->write($taskId, ['state' => Queue::RUNNING]);

            $result = $this->performTask($lambda, $arguments);

            $this->taskRepository->write($taskId, ['state' => Queue::FINISHED]);

            return $result;

        } catch (\Exception $e) {

            $this->taskRepository->writeMessage($taskId, $this->exceptionMessage($e), Chatty::FATAL);
            $this->taskRepository->write($taskId, ['state' => Queue::FAILED]);

        }

    }
public function run ( $ taskId , $ operation , array $ arguments ) { try { $ lambda = new Lambda ( $ operation , $ this -> ioc ) ; if ( $ lambda -> isInstanceMethod ( ) ) { $ this -> connectHooks ( $ taskId , $ lambda -> getCallInstance ( ) ) ; } $ this -> taskRepository -> write ( $ taskId , [ 'state' => Queue :: RUNNING ] ) ; $ result = $ this -> performTask ( $ lambda , $ arguments ) ; $ this -> taskRepository -> write ( $ taskId , [ 'state' => Queue :: FINISHED ] ) ; return $ result ; } catch ( \ Exception $ e ) { $ this -> taskRepository -> writeMessage ( $ taskId , $ this -> exceptionMessage ( $ e ) , Chatty :: FATAL ) ; $ this -> taskRepository -> write ( $ taskId , [ 'state' => Queue :: FAILED ] ) ; } }
Run the desired task and log its state changes.

@param int|string $taskId
@param string     $operation
@param array      $arguments

@return mixed
Run the desired task and log its state changes .