Пример #1
0
 /**
  * @param NodeName $nodeName
  * @param ProcessId $subProcessId
  * @param bool $succeed
  * @param ProcessingMessage $lastReceivedMessage
  * @param TaskListPosition $parentTaskListPosition
  * @throws \InvalidArgumentException
  * @return SubProcessFinished
  */
 public static function record(NodeName $nodeName, ProcessId $subProcessId, $succeed, ProcessingMessage $lastReceivedMessage, TaskListPosition $parentTaskListPosition)
 {
     if (!is_bool($succeed)) {
         throw new \InvalidArgumentException("Succeed must be a boolean");
     }
     $payload = ['processor_node_name' => $nodeName->toString(), 'parent_task_list_position' => $parentTaskListPosition->toString(), 'sub_process_id' => $subProcessId->toString(), 'succeed' => $succeed, 'last_message' => $lastReceivedMessage->toServiceBusMessage()->toArray()];
     return new self(self::MSG_NAME, $payload);
 }
Пример #2
0
 /**
  * @param ProcessId $processId
  * @param TaskListPosition $parentTaskListPosition
  * @param TaskList $taskList
  * @param array $config
  * @param bool $syncLogMessages
  * @throws \InvalidArgumentException
  * @return static
  */
 public static function asSubProcess(ProcessId $processId, TaskListPosition $parentTaskListPosition, TaskList $taskList, array $config, $syncLogMessages)
 {
     if (!is_bool($syncLogMessages)) {
         throw new \InvalidArgumentException("Argument syncLogMessages must be of type boolean");
     }
     $instance = self::occur($processId->toString(), ['config' => $config, 'parent_task_list_Position' => $parentTaskListPosition->toString(), 'task_list' => $taskList->getArrayCopy(), 'sync_log_messages' => $syncLogMessages]);
     $instance->processId = $processId;
     $instance->parentTaskListPosition = $parentTaskListPosition;
     return $instance;
 }
Пример #3
0
 /**
  * @param ProcessId $processId
  * @return Process
  */
 public function get(ProcessId $processId)
 {
     return $this->getAggregateRoot($processId->toString());
 }
Пример #4
0
 /**
  * @param TaskList $newTaskList
  * @param ProcessId $processId
  * @return TaskListWasRescheduled
  */
 public static function with(TaskList $newTaskList, ProcessId $processId)
 {
     $event = self::occur($processId->toString(), ['new_task_list' => $newTaskList->getArrayCopy()]);
     $event->newTaskList = $newTaskList;
     return $event;
 }
 /**
  * @param ProcessId $processId
  * @return null|array
  */
 private function loadProcessEntryIfExists(ProcessId $processId)
 {
     if (isset($this->entries[$processId->toString()])) {
         return $this->entries[$processId->toString()];
     }
     $query = $this->connection->createQueryBuilder();
     $query->select('*')->from(self::TABLE)->where('process_id = :process_id')->setParameter('process_id', $processId->toString());
     $entry = $query->execute()->fetch(\PDO::FETCH_ASSOC);
     if (!$entry) {
         return null;
     }
     $this->entries[$processId->toString()] = $entry;
     return $entry;
 }
 /**
  * @param ProcessId $processId
  * @throws \InvalidArgumentException
  */
 private function setProcessId(ProcessId $processId)
 {
     if (!is_null($this->processId)) {
         throw new \InvalidArgumentException(sprintf('Process id %s can not be logged. Message log already has a process id %s', $processId->toString(), $this->processId()->toString()));
     }
     $this->processId = $processId;
 }
Пример #7
0
 /**
  * @param ProcessId $processId
  * @param int $minVersion
  * @return DomainEvent[]
  */
 public function getStreamOfProcess(ProcessId $processId, $minVersion = 0)
 {
     return $this->eventStore->loadEventsByMetadataFrom(new StreamName('prooph_processing_stream'), ['aggregate_id' => $processId->toString()], $minVersion);
 }