/**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return ProcessManagerController
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $con = new ProcessManagerController();
     $con->setScriptLocation(ScriptLocation::fromPath(Definition::getScriptsDir()));
     $con->setLocationTranslator($serviceLocator->getServiceLocator()->get('prooph.link.app.location_translator'));
     $con->setWorkflowFinder($serviceLocator->getServiceLocator()->get(\Prooph\Link\ProcessManager\Projection\Workflow\WorkflowFinder::class));
     return $con;
 }
 /**
  * Runs the initial set up of the processing system
  */
 public function runAction()
 {
     try {
         $this->commandBus->dispatch(CreateDefaultProcessingConfigFile::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
         $sqliteDbFile = SqliteDbFile::initializeFromDist(Definition::getEventStoreSqliteDbFile());
         $esConfigLocation = ConfigLocation::fromPath(Definition::getSystemConfigDir());
         $this->commandBus->dispatch(InitializeEventStore::setUpWithSqliteDbAdapter($sqliteDbFile, $esConfigLocation));
     } catch (\Exception $ex) {
         $this->commandBus->dispatch(UndoSystemSetUp::removeConfigs(Definition::getSystemConfigDir(), Definition::getSystemConfigDir(), Definition::getEventStoreSqliteDbFile()));
         throw $ex;
     }
     return $this->redirect()->toRoute('prooph.link/system_config');
 }
 /**
  * Handles a POST request to enable or disable the workflow processor message queue
  */
 public function configureWorkflowProcessorMessageQueueAction()
 {
     $queueEnabled = $this->bodyParam('enabled');
     if (!is_bool($queueEnabled)) {
         return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag should be a boolean value')));
     }
     if ($queueEnabled) {
         $this->commandBus->dispatch(EnableWorkflowProcessorMessageQueue::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
     } else {
         $this->commandBus->dispatch(DisableWorkflowProcessorMessageQueue::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
     }
     return ['success' => true];
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     return new Log($serviceLocator->getServiceLocator()->get(ProcessLogFinder::class), $serviceLocator->getServiceLocator()->get('prooph.link.pm.process_stream_reader'), $serviceLocator->getServiceLocator()->get('processing_config'), ScriptLocation::fromPath(Definition::getScriptsDir()));
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     return new ProcessViewController($serviceLocator->getServiceLocator()->get('prooph.link.monitor.process_logger'), $serviceLocator->getServiceLocator()->get('prooph.link.monitor.process_stream_reader'), ScriptLocation::fromPath(Definition::getScriptsDir()), $serviceLocator->getServiceLocator()->get('prooph.link.app.location_translator'));
 }