示例#1
0
 /**
  * @return ProcessId
  */
 public function processId()
 {
     if (is_null($this->processId)) {
         $this->processId = ProcessId::fromString($this->aggregateId());
     }
     return $this->processId;
 }
示例#2
0
 /**
  * @param string $taskListIdStr
  * @throws \InvalidArgumentException
  * @return TaskListId
  */
 public static function fromString($taskListIdStr)
 {
     if (!is_string($taskListIdStr)) {
         throw new \InvalidArgumentException("TaskListIdStr must be string");
     }
     $parts = explode(':TASK_LIST_ID:', $taskListIdStr);
     if (count($parts) != 2) {
         throw new \InvalidArgumentException(sprintf("Invalid taskLIstIdStr %s provided. Needs to have the format: node-name:PROCESS_ID:process-uuid:TASK_LIST_ID:task-list-uuid", $taskListIdStr));
     }
     $envParts = explode(':PROCESS_ID:', $parts[0]);
     if (count($envParts) != 2) {
         throw new \InvalidArgumentException(sprintf("Invalid taskLIstIdStr %s provided. Needs to have the format: node-name:PROCESS_ID:process-uuid:TASK_LIST_ID:task-list-uuid", $taskListIdStr));
     }
     $nodeName = NodeName::fromString($envParts[0]);
     $processId = ProcessId::fromString($envParts[1]);
     return new self($nodeName, $processId, Uuid::fromString($parts[1]));
 }
 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;
 }
 /**
  * @param ActionEvent $e
  */
 public function onProcessDidFinish(ActionEvent $e)
 {
     if ($e->getParam('succeed')) {
         $this->processLogger->logProcessSucceed(ProcessId::fromString($e->getParam('process_id')), \DateTimeImmutable::createFromFormat(\DateTime::ISO8601, $e->getParam('finished_at')));
     } else {
         $this->processLogger->logProcessFailed(ProcessId::fromString($e->getParam('process_id')), \DateTimeImmutable::createFromFormat(\DateTime::ISO8601, $e->getParam('finished_at')));
     }
 }
 /**
  * @return ProcessId
  */
 public function processId()
 {
     return ProcessId::fromString($this->aggregateId);
 }
 /**
  * @param array $messageLogEntryArr
  * @return MessageLogEntry
  * @throws \InvalidArgumentException
  */
 public static function fromArray(array $messageLogEntryArr)
 {
     if (!array_key_exists("message_id", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message id missing in status array');
     }
     if (!array_key_exists("message_name", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message name missing in status array');
     }
     if (!array_key_exists("version", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message version missing in status array');
     }
     if (!array_key_exists("logged_at", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message logged at missing in status array');
     }
     if (!array_key_exists("task_list_position", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message task list position missing in status array');
     }
     if (!array_key_exists("process_id", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message process id missing in status array');
     }
     if (!array_key_exists("status", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message status missing in status array');
     }
     if (!array_key_exists("failure_msg", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Status failure msg position on missing in status array');
     }
     $status = MessageStatus::fromArray($messageLogEntryArr);
     $taskListPosition = is_null($messageLogEntryArr["task_list_position"]) ? null : TaskListPosition::fromString($messageLogEntryArr["task_list_position"]);
     $processId = is_null($messageLogEntryArr["process_id"]) ? null : ProcessId::fromString($messageLogEntryArr["process_id"]);
     return new self(Uuid::fromString($messageLogEntryArr["message_id"]), $messageLogEntryArr["message_name"], (int) $messageLogEntryArr["version"], \DateTime::createFromFormat('Y-m-d\\TH:i:s.uO', $messageLogEntryArr["logged_at"]), $status, $taskListPosition, $processId);
 }
 /**
  * @param ActionEvent $event
  */
 public function onProcessWasStartedByMessage(ActionEvent $event)
 {
     $this->messageLogger->logProcessStartedByMessage(ProcessId::fromString($event->getParam('process_id')), Uuid::fromString($event->getParam('message_id')));
 }
示例#8
0
 /**
  * @return ProcessId
  */
 public function subProcessId()
 {
     return ProcessId::fromString($this->payload['sub_process_id']);
 }