Really dispatches the command to the proper handler to be executed.

@param string $jobId
@param mixed $command

@throws \Exception
420001
public function deferredDispatch($jobId, $command)
    {
        $exception = null;
        $currentCommandLogger = null;
        if ($this->logger) {
            $jobMetadata = array(
                'job_id' => $jobId,
            );
            $currentCommandLogger = new ContextEnrichingLogger(
                $this->logger,
                $jobMetadata
            );
        }

        if ($currentCommandLogger) {
            $currentCommandLogger->info('job_started');
        }

        if ($this->decoratee instanceof LoggerAwareInterface) {
            $this->decoratee->setLogger($currentCommandLogger);
        }

        try {
            parent::dispatch($command);
        } catch (\Exception $e) {
            if ($currentCommandLogger) {
                $currentCommandLogger->error('job_failed');

                $currentCommandLogger->debug(
                    'exception caused job failure',
                    ['exception' => $e]
                );
            }
            $exception = $e;
        }

        $this->setContext(null);

        if ($currentCommandLogger) {
            $currentCommandLogger->info('job_finished');
        }

        if ($exception) {
            throw $exception;
        }
    }
345273
public void executeDirectly(String jobId) {

        final CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo)getJob(jobId).clone();
        if (jobInfo == null) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_JOB_1, "null"));
            return;
        }
        Thread thread = new Thread() {

            /**
             * @see java.lang.Thread#run()
             */
            @Override
            public void run() {

                executeJob(jobInfo);
            }
        };
        thread.start();
    }
267303
public function execute(Command $command)
    {
        if (!$this->innerCommandBus) {
            throw new Exception('No inner bus defined for this decorator. Set an inner bus with setInnerBus()');
        }

        $response = $this->innerCommandBus->execute($command);

        $eventName = $this->getEventName($command);

        $this->dispatcher->dispatch($eventName, [$command]);

        return $response;
    }
1243816
public function dispatch($command): void
    {
        $this->commandStack[] = $command;

        if ($this->executing) {
            return;
        }

        $this->transactionManager->begin();
        try {
            while ($command = array_shift($this->commandStack)) {
                $this->invokeHandler($command);
            }
            $this->eventPublisher->publishEvents();
            $this->transactionManager->commit();
        } catch (Exception $e) {
            $this->transactionManager->rollback();
            throw $e;
        }
    }
45382
protected function doExcute(array $command = array())
    {

        try {
            // prepare the application's lookup name with the first argument, which has to be the application name
            $lookupName = sprintf('php:global/combined-appserver/%s/ApplicationInterface', array_shift($command));

            // try to load the application
            /** \AppserverIo\Psr\Application\ApplicationInterface $application */
            $application = $this->getNamingDirectory()->search($lookupName);

            // try to load the application's console manager and execute the command
            /** @var \AppserverIo\Appserver\Console\ConsoleContextInterface $consoleManager */
            $consoleManager = $application->search(ConsoleContextInterface::IDENTIFIER);
            $consoleManager->execute($this->connection, $command);

        } catch (\Exception $e) {
            // log the exception
            $this->getSystemLogger()->error($e->__toString());
            // write the error message to the output
            $this->write("{$e->__toString()}ERROR\n");
        }
    }
540414
public function peek($jobId)
	{
		$response = $this->_dispatch(
			new Pheanstalk_Command_PeekCommand($jobId)
		);

		return new Pheanstalk_Job($response['id'], $response['jobdata']);
	}
626308
public function dispatch($command)
    {
        if (! is_null($this->queueResolver) && $this->commandShouldBeQueued($command)) {
            return $this->dispatchToQueue($command);
        } else {
            return $this->dispatchNow($command);
        }
    }
983799
public function fireUpdatingCommand(Command $command)
    {
        $this->handleMainCommand($command);

        event(new SystemWasUpdatedEvent());

        $command->info('System was updated!');
    }
282933
protected function handleAddJobToJobSeekerCommand(AddJobToJobSeekerCommand $command)
    {
        $jobSeeker = $this->repository->load($command->jobSeekerId);

        $jobSeeker->heldJob($command->jobId, $command->title, $command->description);

        $this->repository->save($jobSeeker);
    }
1010854
public function call(Job $job, array $data)
    {
        try {
            $command = $this->setJobInstanceIfNecessary(
                $job, unserialize($data['command'])
            );
        } catch (ModelNotFoundException $e) {
            $this->handleModelNotFound($job, $e);
            return;
        }

        try {
            $this->dispatcher->dispatchNow($command, $this->resolveHandler($job, $command));
        } catch (\Exception $e) {
            if ($command instanceof ErrorHandler) {
                $command->errorHandle($e);
            }

            throw $e;
        } finally {
            app()->instance('QueueCurrentJob', $command);
        }

        if (!$job->hasFailed() && !$job->isReleased()) {
            $this->ensureNextJobInChainIsDispatched($command);
        }

        if (!$job->isDeletedOrReleased()) {
            $job->delete();
        }
    }
298394
def dispatch(self, command):
        
        log.info("Dispatch on %s", command)
        if not command:
            return "OK"
        
        action, params = self.parse_command(command)
        log.debug("Action = %s, Params = %s", action, params)
        try:
            function = getattr(self, "do_" + action, None)
            if function:
                function(*params)
            return "OK"
        except KeyboardInterrupt:
            raise
        except Exception as exc:
            log.exception("Problem executing action %s", action)
            return "ERROR: %s" % exc
168338
private function stopExecution(string $jobId, string $executionArn): void
    {
        try {
            $this->sfnClient->stopExecution([
                'executionArn' => $executionArn,
                'cause'        => 'canceled',
            ]);
        } catch (\Throwable $t) {
            $this->logger->error(
                'Failed to stopExecution of [{execution_arn}] for [{job_id}].',
                [
                    'exception'     => $t,
                    'execution_arn' => $executionArn,
                    'job_id'        => $jobId,
                ]
            );
        }
    }
243137
protected function onJobCompleted(string $workerId, string $jobId, string $result = '')
    {
        $jobType = $this->jobTypes[$jobId];
        $clientAddress = $this->jobAddresses[$jobId];
        if ($jobType === 'normal') {
            $this->respondToClient($clientAddress, $result);
        }
        unset(
            $this->jobTypes[$jobId],
            $this->jobAddresses[$jobId],
            $this->workerJobMap[$workerId]
        );
    }
1135010
protected function saveJobResult($id, $jobEvent)
    {
        if ($jobEvent) {
            $queueEvent = new QueueSaveJobResultEvent();
            $queueEvent->setId($id);
            $queueEvent->setData($jobEvent);
            $this->dispatcher->dispatch($queueEvent::NAME, $queueEvent);
        }
    }
618732
public function execute(interfaces\commands\Command $command)
    {
        $handler = $this->resolver->resolve($command);
        
        return call_user_func([$handler, 'handle'], $command);
    }
91747
public function fire(Command $command)
    {
        if ($command->option('verbose')) {
            $command->blockMessage('Migrations', 'Starting the module migrations ...', 'comment');
        }

        foreach ($this->modules as $module) {
            if ($command->option('verbose')) {
                $command->call('module:migrate', ['module' => $module]);
                continue;
            }
            $command->callSilent('module:migrate', ['module' => $module]);
        }
    }
1351478
public function handle($command)
    {
        $this->commandStack[] = $command;

        if ($this->executing) {
            return;
        }

        $first = true;

        while ($command = array_shift($this->commandStack)) {
            $this->invokeHandler($command, $first);
            $first = false;
        }
    }