/** * @param $startMessage * @param array $processDefinition * @param array $knownProcessingTypes * @param ScriptLocation $scriptLocation * @return array */ public static function translate($startMessage, array $processDefinition, array $knownProcessingTypes, ScriptLocation $scriptLocation) { $messageType = MessageNameUtils::getMessageSuffix($startMessage); foreach ($processDefinition['tasks'] as $i => &$task) { $task['id'] = $i; } return ['id' => $startMessage, 'name' => $processDefinition['name'], 'process_type' => $processDefinition['process_type'], 'start_message' => ['message_type' => $messageType, 'processing_type' => ProcessingTypeClass::extractFromMessageName($startMessage, $knownProcessingTypes)], 'tasks' => array_map(function ($task) use($scriptLocation) { if ($task['task_type'] === Definition::TASK_MANIPULATE_PAYLOAD) { $task['manipulation_script'] = str_replace($scriptLocation->toString() . DIRECTORY_SEPARATOR, "", $task['manipulation_script']); } return $task; }, $processDefinition['tasks'])]; }
/** * 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; }
public function startAppAction() { $workflows = $this->workflowFinder->findAll(); $viewModel = new ViewModel(['workflows' => $workflows, 'processes' => array_values(Func::map($this->systemConfig->getProcessDefinitions(), function ($definition, $message) { return $this->convertToClientProcess($message, $definition, $this->systemConfig->getAllAvailableProcessingTypes()); })), 'connectors' => array_values(Func::map($this->systemConfig->getConnectors(), function ($connector, $id) { $connector['id'] = $id; if (!isset($connector['metadata']) || empty($connector['metadata'])) { //Force empty object $connector['metadata'] = new \stdClass(); } return $connector; })), 'available_processing_types' => $this->getProcessingTypesForClient(), 'available_manipulation_scripts' => $this->scriptLocation->getScriptNames(), 'locations' => $this->locationTranslator->getLocations(), 'available_process_types' => [['value' => \Prooph\Processing\Processor\Definition::PROCESS_LINEAR_MESSAGING, 'label' => $this->i18nTranslator->translate('Linear Process')], ['value' => \Prooph\Processing\Processor\Definition::PROCESS_PARALLEL_FOR_EACH, 'label' => $this->i18nTranslator->translate('Foreach Process')]], 'available_task_types' => [['value' => \Prooph\Processing\Processor\Definition::TASK_COLLECT_DATA, 'label' => $this->i18nTranslator->translate('Collect Data')], ['value' => \Prooph\Processing\Processor\Definition::TASK_PROCESS_DATA, 'label' => $this->i18nTranslator->translate('Process Data')], ['value' => \Prooph\Processing\Processor\Definition::TASK_MANIPULATE_PAYLOAD, 'label' => $this->i18nTranslator->translate('Run Manipulation Script')]], 'available_messages' => [['value' => 'collect-data', 'label' => $this->i18nTranslator->translate('Collect Data Message')], ['value' => 'data-collected', 'label' => $this->i18nTranslator->translate('Data Collected Message')], ['value' => 'process-data', 'label' => $this->i18nTranslator->translate('Process Data Message')]]]); $viewModel->setTemplate('prooph.link.process-manager/process-manager/app'); $this->layout()->setVariable('includeRiotJs', true); return $viewModel; }
public function detailsAction() { $processId = ProcessId::fromString($this->params('process_id')); $process = $this->processLogger->getLoggedProcess($processId); if (is_null($process)) { return $this->notFoundAction(); } $process['events'] = $this->convertToClientProcessEvents($this->processStreamReader->getStreamOfProcess($processId)); if (!isset($process['start_message']) || !isset($this->systemConfig->getProcessDefinitions()[$process['start_message']])) { return $this->incompleteAction($process); } $definition = $this->convertToClientProcess($process['start_message'], $this->systemConfig->getProcessDefinitions()[$process['start_message']], $this->systemConfig->getAllAvailableProcessingTypes()); $process = array_merge($process, $definition); $this->populateTaskEvents($process); $view = new ViewModel(['process' => $process, 'available_processing_types' => $this->getProcessingTypesForClient(), 'available_task_types' => \Prooph\Processing\Processor\Definition::getAllTaskTypes(), 'available_manipulation_scripts' => $this->scriptLocation->getScriptNames(), 'locations' => $this->locationTranslator->getLocations(), 'connectors' => array_values(Func::map($this->systemConfig->getConnectors(), function ($connector, $id) { $connector['id'] = $id; return $connector; }))]); $view->setTemplate('prooph/link/monitor/process-view/process-details-app'); $this->layout()->setVariable('includeRiotJs', true); return $view; }
/** * 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')); }