Start or continue the process with the help of given WorkflowEngine and optionally with given WorkflowMessage

@param WorkflowEngine $workflowEngine
@param WorkflowMessage $workflowMessage
@return void
330697
public function perform(WorkflowEngine $workflowEngine, WorkflowMessage $workflowMessage = null)
    {
        if (is_null($workflowMessage)) {
            $this->startWithoutMessage($workflowEngine);
            return;
        }

        $taskListEntry = $this->taskList->getNextNotStartedTaskListEntry();

        if ($taskListEntry) {
            $this->recordThat(TaskEntryMarkedAsRunning::at($taskListEntry->taskListPosition()));

            if (! $this->isCorrectMessageFor($taskListEntry->task(), $workflowMessage)) {
                $this->receiveMessage(
                    LogMessage::logWrongMessageReceivedFor(
                        $taskListEntry->task(),
                        $taskListEntry->taskListPosition(),
                        $workflowMessage
                    ),
                    $workflowEngine
                );

                return;
            }



            $this->performTask($taskListEntry->task(), $taskListEntry->taskListPosition(), $workflowEngine, $workflowMessage);
            return;
        }
    }
791727
protected function registerTasksForUpdateMethod(Workflow $workflow, $updateMethod)
    {
        switch ($updateMethod) {
            case 'composer':
                $workflow->addTask(InstallTask::class, 'update', $this);
                break;
            default:
                parent::registerTasksForUpdateMethod($workflow, $updateMethod);
                break;
        }
    }
1170650
protected function loadWorkflow(WorkflowConfig $c, $validate = true)
    {
        $validate = (boolean)$validate;
        try {
            $c->descriptor = WorkflowLoader::load($c->url, $validate);
        } catch (\Exception $e) {
            $errMsg = "Некорректный дескрипторв workflow: {$c->url}";
            throw new FactoryException($errMsg, $e->getCode(), $e);
        }
    }
1293646
public function handle(PipeMessageEventParam $e)
    {
        if('app.inited' === $e->message && 0 === $e->workerID)
        {
            while(!Worker::isInited())
            {
                Coroutine::sleep(0.01);
            }

            if(isset($GLOBALS['WORKER_START_END_RESUME_COIDS']))
            {
                foreach($GLOBALS['WORKER_START_END_RESUME_COIDS'] as $id)
                {
                    Coroutine::resume($id);
                }
                unset($GLOBALS['WORKER_START_END_RESUME_COIDS']);
            }

            $e->stopPropagation();
        }
    }
737214
public function onAfterDelete()
    {
        parent::onAfterDelete();
        $wfActionInstances = WorkflowActionInstance::get()
            /** @skipUpgrade */
            ->leftJoin('WorkflowInstance', '"WorkflowInstance"."ID" = "WorkflowActionInstance"."WorkflowID"')
            ->where(sprintf('"BaseActionID" = %d AND ("WorkflowStatus" IN (\'Active\',\'Paused\'))', $this->ID));
        foreach ($wfActionInstances as $wfActionInstance) {
            $wfInstances = WorkflowInstance::get()->filter('CurrentActionID', $wfActionInstance->ID);
            foreach ($wfInstances as $wfInstance) {
                $wfInstance->Groups()->removeAll();
                $wfInstance->Users()->removeAll();
                $wfInstance->delete();
            }
            $wfActionInstance->delete();
        }
        // Delete outbound transitions
        $transitions = WorkflowTransition::get()->filter('ActionID', $this->ID);
        foreach ($transitions as $transition) {
            $transition->Groups()->removeAll();
            $transition->Users()->removeAll();
            $transition->delete();
        }
    }
698326
public void processEvents(String msgid, String textMessage) {
        try {
            if (logger.isDebugEnabled())
                logger.debug("executeFlow: " + textMessage);
            InternalEvent event = new InternalEvent(textMessage);
            // a. find the process instance (looking for memory only first, then regular)
            Long procInstId;
            ProcessInstance procInst;
            if (event.isProcess()) {
                if (event.getEventType().equals(EventType.FINISH)) {
                    procInstId = null;    // not needed, and for remote process returns, will not be able to find it
                } else {
                    procInstId = event.getWorkInstanceId();
                }
            } else {
                procInstId = event.getOwnerId();
            }
            if (procInstId != null) {
                EngineDataAccess temp_edao = EngineDataAccessCache.getInstance(false, 9);
                procInst = temp_edao.getProcessInstance(procInstId);
                if (procInst==null) {
                    TransactionWrapper transaction = null;
                    EngineDataAccessDB edbao = new EngineDataAccessDB();
                    try {
                        transaction = edbao.startTransaction();
                        procInst = edbao.getProcessInstance(procInstId);
                    }
                    catch (SQLException ex) {
                        if (("Failed to load process instance: " + procInstId).equals(ex.getMessage())) {
                            if (ApplicationContext.isDevelopment()) {
                                logger.severe("Unable to load process instance id=" + procInstId + ".  Was this instance deleted?");
                                return;
                            } else {
                                throw ex;
                            }
                        }
                    }
                    finally {
                        edbao.stopTransaction(transaction);
                    }
                }
            } else {
                procInst = null;
            }
            // b. now determine performance level here
            int performance_level;
            if (procInst == null) {        // must be process start message
                if (event.isProcess() && event.getEventType().equals(EventType.START)) {
                    Process procdef = getProcessDefinition(event.getWorkId());
                    performance_level = procdef.getPerformanceLevel();
                } else {
                    performance_level = 0;
                }
            } else {
                Process procdef = getProcessDefinition(procInst.getProcessId());
                if (procdef == null) {
                    String msg = "Unable to load process id " + procInst.getProcessId() + " (instance id=" + procInst.getId() + ") for " + msgid;
                    if (ApplicationContext.isDevelopment()) {
                        // referential integrity not always enforced for VCS assets
                        if (PropertyManager.getBooleanProperty(PropertyNames.MDW_INTERNAL_EVENT_DEV_CLEANUP, true)) {
                            logger.severe(msg + " (event will be deleted)");
                            EngineDataAccess edao = EngineDataAccessCache.getInstance(false, default_performance_level_regular);
                            InternalMessenger msgBroker = MessengerFactory.newInternalMessenger();
                            ProcessExecutor engine = new ProcessExecutor(edao, msgBroker, false);
                            engine.deleteInternalEvent(msgid);
                            return;
                        }
                        else {
                            logger.severe(msg);
                        }
                    }
                    else {
                        throw new WorkflowException(msg);
                    }
                }
                performance_level = procdef.getPerformanceLevel();
            }
            if (performance_level <= 0)
                performance_level = default_performance_level_regular;
            // c. create engine
            EngineDataAccess edao = EngineDataAccessCache.getInstance(false, performance_level);
            InternalMessenger msgBroker = MessengerFactory.newInternalMessenger();
            ProcessExecutor engine = new ProcessExecutor(edao, msgBroker, false);
            if (msgid != null) {
                boolean success = engine.deleteInternalEvent(msgid);
                if (!success) {
                    // retry two times to get around race condition (internal event inserted
                    // into EVENT_INSTANCE table but not committed yet)
                    int retries = 0;
                    while (!success && retries < 2) {
                        logger.debug("Failed to consume internal event " + msgid + " - retry in 2 seconds");
                        Thread.sleep(eventConsumeRetrySleep * 1000);
                        retries++;
                        success = engine.deleteInternalEvent(msgid);
                    }
                }
                if (!success) {
                    logger.warn("Fail to consume internal event " + msgid + " - assuming the event is already processed by another thread");
                    return;    // already processed;
                }
            }
            if (performance_level >= 9)
                msgBroker.setCacheOption(InternalMessenger.CACHE_ONLY);
            else if (performance_level >= 3)
                msgBroker.setCacheOption(InternalMessenger.CACHE_ON);
            // d. process event(s)
            if (performance_level >= 3) {
                // TODO cache proc inst
                processEvent(engine, event, procInst);
                while ((event = msgBroker.getNextMessageFromQueue(engine)) != null) {
                    procInst = this.findProcessInstance(engine, event);
                    processEvent(engine, event, procInst);
                }
            } else {
                processEvent(engine, event, procInst);
            }
        } catch (XmlException e) {
            logger.severeException("Unparsable xml message: " + textMessage, e);
        } catch (Throwable ex) {
            logger.severeException(ex.getMessage(), ex);
        }
    }
1095925
public function onCheckRunWorkflowHandler(WorkflowDispatchEventInterface $e)
    {
        $metadata = $e->getMetadata();
        if (!$metadata->getFlagHasConditions()) {
            return null;
        }

        try {
            $conditions = $metadata->getConditions();

            $validatorManager = $this->getValidatorManager();

            /** @var ValidatorChain $validatorChains */
            $validatorChains = $validatorManager->get(ValidatorChain::class);
        } catch (\Exception $e) {
            throw new Exception\PrepareDataException($e->getMessage(), $e->getCode(), $e);
        }



        $mvcEvent = $e->getMvcEvent();
        $controller = $mvcEvent->getTarget();
        if (!$controller instanceof AbstractController) {
            $controller = null;
        }


        foreach ($conditions as $condition) {
            try {
                $type = $condition->getType();
                $handler = $condition->getHandler();
                switch ($type) {
                    case 'method': {
                        if (null === $controller) {
                            $errMsg = 'Controller not specified';
                            throw new Exception\CheckRunWorkflowEventException($errMsg);
                        }
                        $callback = [$controller, $handler];

                        /** @var ValidatorInterface $callbackValidator */
                        $callbackValidator = $validatorManager->get('callback', $callback);

                        $validatorChains->attach($callbackValidator);

                        break;
                    }
                    case 'service': {
                        $validatorParams = $condition->getParams();

                        /** @var ValidatorInterface $validator */
                        $validator = $validatorManager->get($handler, $validatorParams);

                        $validatorChains->attach($validator);

                        break;
                    }
                    default: {
                        $errMsg = sprintf('Preparing data for Workflow will fail. Unknown handler type %s.', $type);
                        throw new Exception\PrepareDataException($errMsg);
                    }
                }
            } catch (\Exception $e) {
                throw new Exception\PrepareDataException($e->getMessage(), $e->getCode(), $e);
            }
        }

        return $validatorChains->isValid($e);
    }
1106963
static function runWorkflow( $workflowProcess )
    {
        $workflow = eZWorkflow::fetch( $workflowProcess->attribute( "workflow_id" ) );
        $workflowEvent = null;

        $workflowStatus = $workflowProcess->run( $workflow, $workflowEvent, $eventLog );

        $db = eZDB::instance();
        $db->begin();
        $workflowProcess->store();

        switch ( $workflowStatus )
        {
            case eZWorkflow::STATUS_FAILED:
            case eZWorkflow::STATUS_CANCELLED:
            case eZWorkflow::STATUS_NONE:
            case eZWorkflow::STATUS_BUSY:
            {
                $workflowProcess->removeThis();
                $db->commit();
                return array( 'Status' => eZTrigger::WORKFLOW_CANCELLED,
                              'Result' => null );
            } break;
            case eZWorkflow::STATUS_FETCH_TEMPLATE:
            case eZWorkflow::STATUS_FETCH_TEMPLATE_REPEAT:
            {
                $tpl = eZTemplate::factory();
                $result = array();
                foreach ( array_keys( $workflowProcess->Template['templateVars'] ) as $key )
                {
                    $value = $workflowProcess->Template['templateVars'][$key];
                    $tpl->setVariable( $key, $value );
                }
                $result['content'] = $tpl->fetch( $workflowProcess->Template['templateName'] );
                if ( isset( $workflowProcess->Template['path'] ) )
                    $result['path'] = $workflowProcess->Template['path'];

                    $db->commit();
                if ( $workflowStatus == eZWorkflow::STATUS_FETCH_TEMPLATE )
                {
                    $triggerStatus = eZTrigger::FETCH_TEMPLATE;
                }
                elseif ( $workflowStatus == eZWorkflow::STATUS_FETCH_TEMPLATE_REPEAT )
                {
                    $triggerStatus = eZTrigger::FETCH_TEMPLATE_REPEAT;
                }
                return array( 'Status' => $triggerStatus,
                              'WorkflowProcess' => $workflowProcess,
                              'Result' => $result );
            } break;
            case eZWorkflow::STATUS_REDIRECT:
            {
//                var_dump( $workflowProcess->RedirectUrl  );
                $db->commit();
                return array( 'Status' => eZTrigger::REDIRECT,
                              'WorkflowProcess' => $workflowProcess,
                              'Result' => $workflowProcess->RedirectUrl );

            } break;
            case eZWorkflow::STATUS_DEFERRED_TO_CRON:
            {

                $db->commit();
                return array( 'Status' => eZTrigger::STATUS_CRON_JOB,
                              'WorkflowProcess' => $workflowProcess,
                              'Result' => array( 'content' => 'Deffered to cron. Operation halted during execution. <br/>Refresh page to continue<br/><br/><b>Note: The halt is just a temporary test</b><br/>',
                                                 'path' => array( array( 'text' => 'Operation halt',
                                                                         'url' => false ) ) ) );
/*
                return array( 'Status' => eZTrigger::STATUS_CRON_JOB,
                              'Result' => $workflowProcess->attribute( 'id') );
*/
            } break;
            case eZWorkflow::STATUS_RESET:
            {
                $db->commit();
                return array( 'Status' => eZTrigger::WORKFLOW_RESET,
                              'WorkflowProcess' => $workflowProcess,
                              'Result' => array( 'content' => 'Workflow was reset',
                                                 'path' => array( array( 'text' => 'Operation halt',
                                                                         'url' => false ) ) ) );
            } break;
            case eZWorkflow::STATUS_DONE:
            {
                $workflowProcess->removeThis();
                $db->commit();
                return array( 'Status' => eZTrigger::WORKFLOW_DONE,
                              'Result' => null );
            }
        }

        $db->commit();
        return array( 'Status' => eZTrigger::WORKFLOW_CANCELLED,
                      'Result' => null );



    }
1323116
protected void start() throws WorkException
   {
      if (trace)
         log.tracef("Starting work: %s", this);  

      if (workListener != null)
      {
         long duration = System.currentTimeMillis() - startTime;
         if (duration < 0)
            duration = javax.resource.spi.work.WorkManager.UNKNOWN;

         WorkEvent event = new WorkEvent(workManager, WorkEvent.WORK_STARTED, work, null, duration);
         workListener.workStarted(event);
      }

      // Transaction setup
      ExecutionContext ctx = getWorkContext(TransactionContext.class);
      if (ctx == null)
      {
         ctx = getExecutionContext();
      }
      
      if (ctx != null)
      {
         Xid xid = ctx.getXid();
         if (xid != null)
         {
            //JBAS-4002 base value is in seconds as per the API, here we convert to millis
            long timeout = (ctx.getTransactionTimeout() * 1000);
            workManager.getXATerminator().registerWork(work, xid, timeout);
         }
      }

      // Fire complete for transaction context
      fireWorkContextSetupComplete(ctx);
      
      // Security setup
      javax.resource.spi.work.SecurityContext securityContext = 
         getWorkContext(javax.resource.spi.work.SecurityContext.class);
      if (securityContext != null && workManager.getCallbackSecurity() != null)
      {
         if (trace)
            log.tracef("Setting security context: %s", securityContext);

         try
         {
            // Security context
            org.ironjacamar.core.spi.security.SecurityContext sc = null;

            // Setup callback handler
            CallbackHandler cbh = null;
            if (workManager.getCallbackSecurity() != null && workManager.getCallbackSecurity().isMappingRequired())
            {
               cbh = securityIntegration.createCallbackHandler(workManager.getCallbackSecurity());
            }

            if (cbh == null)
               cbh = securityIntegration.createCallbackHandler();

            // Subjects for execution environment
            Subject executionSubject = null;
            Subject serviceSubject = null;
         
            if (trace)
               log.tracef("Callback security: %s", workManager.getCallbackSecurity());

            if (securityIntegration.getSecurityContext() == null ||
                workManager.getCallbackSecurity().getDomain() != null)
            {
               String scDomain = workManager.getCallbackSecurity().getDomain();

               if (trace)
                  log.tracef("Creating security context: %s", scDomain);

               if (scDomain == null || scDomain.trim().equals(""))
               {
                  fireWorkContextSetupFailed(securityContext);
                  throw new WorkException(bundle.securityContextSetupFailedSinceCallbackSecurityDomainWasEmpty());
               }

               sc = securityIntegration.createSecurityContext(scDomain);
               securityIntegration.setSecurityContext(sc);
            }
            else
            {
               sc = securityIntegration.getSecurityContext();

               if (trace)
                  log.tracef("Using security context: %s", sc);
            }

            executionSubject = sc.getAuthenticatedSubject();

            if (executionSubject == null)
            {
               if (trace)
                  log.tracef("Creating empty subject");

               executionSubject = new Subject();
            }

            // Resource adapter callback
            securityContext.setupSecurityContext(cbh, executionSubject, serviceSubject);

            if (workManager.getCallbackSecurity() != null)
            {
               List<Callback> callbacks = new ArrayList<Callback>();
               if (workManager.getCallbackSecurity().getDefaultPrincipal() != null)
               {
                  Principal defaultPrincipal = workManager.getCallbackSecurity().getDefaultPrincipal();

                  if (trace)
                     log.tracef("Adding default principal: %s", defaultPrincipal);

                  CallerPrincipalCallback cpc =
                     new CallerPrincipalCallback(executionSubject, defaultPrincipal);

                  callbacks.add(cpc);
               }

               if (workManager.getCallbackSecurity().getDefaultGroups() != null)
               {
                  String[] defaultGroups = workManager.getCallbackSecurity().getDefaultGroups();

                  if (trace)
                     log.tracef("Adding default groups: %s", Arrays.toString(defaultGroups));
                  
                  GroupPrincipalCallback gpc = 
                     new GroupPrincipalCallback(executionSubject, defaultGroups);

                  callbacks.add(gpc);
               }

               if (!callbacks.isEmpty())
               {
                  Callback[] cb = new Callback[callbacks.size()];
                  cbh.handle(callbacks.toArray(cb));
               }
            }

            if (trace)
               log.tracef("Setting authenticated subject (%s) on security context (%s)", executionSubject, sc);

            // Set the authenticated subject
            sc.setAuthenticatedSubject(executionSubject);

            // Fire complete for security context
            fireWorkContextSetupComplete(securityContext);
         }
         catch (Throwable t)
         {
            log.securityContextSetupFailed(t.getMessage(), t);
            fireWorkContextSetupFailed(securityContext);
            throw new WorkException(bundle.securityContextSetupFailed(t.getMessage()), t);
         }
      }
      else if (securityContext != null && workManager.getCallbackSecurity() == null)
      {
         log.securityContextSetupFailedCallbackSecurityNull();
         fireWorkContextSetupFailed(securityContext);
         throw new WorkException(bundle.securityContextSetupFailedSinceCallbackSecurityWasNull());
      }
   
      if (ctx != null)
      {
         Xid xid = ctx.getXid();
         if (xid != null)
         {
            workManager.getXATerminator().startWork(work, xid);
         }
      }

      if (trace)
         log.tracef("Started work: %s", this);  
   }
282735
public function load(ObjectManager $manager)
    {
        if (true == $this->hasReference('workflow-function-validator-production')) {
            $workflowRight = new WorkflowRight();
            $workflowRight->setUserId($this->getReference('user-admin')->getId());

            $authorization = new Authorization();
            $authorization->setReferenceId(WorkflowRightInterface::NODE);
            $authorization->addWorkflowFunction($this->getReference('workflow-function-validator-production'));

            $workflowRight->addAuthorization($authorization);

            $manager->persist($workflowRight);
            $manager->flush();
        }
    }
703863
function (config, cb) {
        var w = new WorkflowExecution(this.swfClient, this.config);
        w.start(config, cb);
        return w;
    }
522673
public function initialize($instance, ServiceLocator $serviceLocator)
    {
        if ($instance instanceof WorkflowMessageHandler) {
            /** @var $env Environment */
            $env = $serviceLocator->get(Definition::SERVICE_ENVIRONMENT);

            $instance->useWorkflowEngine($env->getWorkflowEngine());
        }
    }
1294256
public function handle(StartEventParam $e)
    {
        Imi::setProcessName('master');
        echo 'Server start', PHP_EOL;
        $mainSwooleServer = ServerManage::getServer('main')->getSwooleServer();
        echo 'WorkerNum: ', $mainSwooleServer->setting['worker_num'], ', TaskWorkerNum: ', $mainSwooleServer->setting['task_worker_num'], PHP_EOL;
        foreach(ServerManage::getServers() as $server)
        {
            if($server->isSubServer())
            {
                $serverPort = $server->getSwoolePort();
            }
            else
            {
                $serverPort = $server->getSwooleServer();
            }
            echo '[', $server->getConfig()['type'], '] ', $server->getName(), '; listen: ', $serverPort->host, ':', $serverPort->port, PHP_EOL;
        }
    }
766822
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->workflowRegistry instanceof Registry) {
            throw new Exception('Can not execute task: No workflows were defined');
        }

        $taskId = $input->getArgument('task-id');

        $callback = function () use ($taskId) {
            $task = $this->entityManager->find(Task::class, $taskId);

            if ($task instanceof Task) {
                $task->setStatus('in-progress');
            }

            return $task;
        };

        $task = $this->entityManager->transactional($callback);

        if (!$task instanceof Task) {
            $output->writeln(sprintf('No task found for id %d', $taskId));

            return;
        }

        $this->setAnonymousToken();

        $subject = $this->subjectManager->createSubject($task->getModel());
        $subject->setUp();
        $generator = $this->generatorManager->getGenerator($task->getGenerator());
        $workflow = $this->workflowRegistry->get($subject, $task->getModel());

        $path = new Path();
        $path->add(null, null, [$workflow->getDefinition()->getInitialPlace()]);

        try {
            foreach ($generator->getAvailableTransitions($workflow, $subject, $task->getMetaData()) as $transitionName) {
                try {
                    if (!$generator->applyTransition($workflow, $subject, $transitionName)) {
                        throw new Exception(sprintf("Generator '%s' generated transition '%s' that can not be applied", $task->getGenerator(), $transitionName));
                    }
                } catch (Throwable $throwable) {
                    throw $throwable;
                } finally {
                    $data = $subject->getStoredData();
                    $places = array_keys(array_filter($workflow->getMarking($subject)->getPlaces()));
                    $path->add($transitionName, $data, $places);
                }
            }
        } catch (Throwable $throwable) {
            $message = new CreateBugMessage(
                $this->defaultBugTitle,
                Path::serialize($path),
                $path->countPlaces(),
                $throwable->getMessage(),
                $task->getId(),
                'new'
            );
            $this->messageBus->dispatch($message);
        } finally {
            $subject->tearDown();

            $this->messageBus->dispatch(new UpdateTaskStatusMessage($taskId, 'completed'));
        }
    }
1127438
public function handle(DomainMessage $domainMessage): void
    {
        $event = $domainMessage->getPayload();

        foreach ($this->sagas as $sagaType => $saga) {
            $metadata = $this->metadataFactory->create($saga);

            if (! $metadata->handles($event)) {
                continue;
            }

            $state = $this->stateManager->findOneBy($metadata->criteria($event), $sagaType);

            if (null === $state) {
                continue;
            }
            $this->eventDispatcher->dispatch(
                SagaManagerInterface::EVENT_PRE_HANDLE,
                [$sagaType, $state->getId()]
            );

            $newState = $saga->handle($event, $state);

            $this->eventDispatcher->dispatch(
                SagaManagerInterface::EVENT_POST_HANDLE,
                [$sagaType, $state->getId()]
            );

            $this->repository->save($newState, $sagaType);
        }
    }
1109969
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
    {
        if (!$this->workflowRegistry instanceof Registry) {
            throw new Exception('Can not make subject: No workflows were defined');
        }

        $model = $input->getArgument('model');
        $workflow = WorkflowHelper::get($this->workflowRegistry, $model);

        if ($this->subjectManager->hasSubject($model)) {
            $subject = $this->subjectManager->getSubject($model);
            if (class_exists($subject)) {
                $io->text(sprintf('The subject for model %s has been already defined: %s!', $model, $subject));

                return;
            }
        } else {
            $subject = $input->getArgument('subject-class');
        }

        $subjectClassNameDetails = $generator->createClassNameDetails(
            $subject,
            'Subject\\'
        );

        $methods = [];
        foreach ($workflow->getDefinition()->getPlaces() as $place => $status) {
            if ($status) {
                $methods[] = $place;
            }
        }
        foreach ($workflow->getDefinition()->getTransitions() as $transition) {
            $methods[] = $transition->getName();
        }

        $generator->generateClass(
            $subjectClassNameDetails->getFullName(),
            __DIR__.'/../Resources/skeleton/subject/Subject.php.tpl',
            [
                'methods' => array_unique($methods),
                'model' => $model,
            ]
        );

        $generator->writeChanges();

        $this->writeSuccessMessage($io);
        $io->text([
            'Next: Open the new generated subject class and implement places and transitions!',
        ]);
    }
952123
protected void startEngine() {

        if (m_engineState != CmsPublishEngineState.ENGINE_STARTED) {
            m_engineState = CmsPublishEngineState.ENGINE_STARTED;
            // start publish job if jobs waiting
            if ((m_currentPublishThread == null) && !m_publishQueue.isEmpty()) {
                checkCurrentPublishJobThread();
            }
        }
    }