15 parent::__construct($instanceId, $runtime);
16 $this->persister = Persister::GetPersister();
25 $this->toggleQueueExceptions();
27 return [
'activitiesQueue',
'eventsQueue'];
32 $this->toggleQueueExceptions();
35 private function toggleQueueExceptions()
37 foreach ($this->activitiesQueue as $index => $item)
39 if ($item[1] === CBPActivityExecutorOperationType::HandleFault && isset($item[2]))
41 if ($item[2] instanceof \Exception)
43 $this->activitiesQueue[$index][2] = [$item[2]->getMessage(), $item[2]->getCode()];
45 elseif (is_array($item[2]))
47 $this->activitiesQueue[$index][2] = new \Exception($item[2][0], $item[2][1]);
55 parent::setWorkflowStatus($newStatus);
63 foreach ($this->getEventsMap() as $id => $handlers)
65 foreach ($handlers as $handler)
67 if ($handler instanceof \IBPActivityDebugEventListener)
78 public function addEventHandler($eventName, IBPActivityExternalEventListener $eventHandler)
80 parent::addEventHandler($eventName, $eventHandler);
82 if ($eventHandler instanceof \IBPActivityDebugEventListener)
90 parent::removeEventHandler($eventName, $eventHandler);
92 if ($eventHandler instanceof \IBPActivityDebugEventListener)
100 $service = $this->runtime->getDebugService($name);
102 if (is_null($service))
104 $service = $this->runtime->GetService($name);
112 $debuggerState = Manager::getDebuggerState();
114 if ($debuggerState->is(DebuggerState::NEXT_STEP))
118 elseif ($debuggerState->is(DebuggerState::RUN))
126 $eventParameters[
'DebugEvent'] =
true;
128 $this->sendExternalEvent($eventName, $eventParameters);
131 public function reload(\CBPActivity $rootActivity)
133 $this->activitiesQueue = $rootActivity->workflow->activitiesQueue;
134 $this->eventsQueue = $rootActivity->workflow->eventsQueue;
136 parent::reload($rootActivity);