/** * Execute a task * * @param TaskSchema $task * @param WorkEvent $event */ protected function executeTask(TaskSchema $task, WorkEvent $event) { $memory_pool = $this->getWorkflow()->getJailMemoryPool() ? JailedMemoryPool::jail($this->getMemoryPool(), ':' . $event->getExecutionId()) : $this->getMemoryPool(); $class = $task->getClass(); /** @var TaskInterface $obj */ $obj = new $class($memory_pool, $event->getInput(), $this->getAuxPayload()); if (!$obj instanceof TaskInterface) { throw new \DomainException("Class for task " . $task->getActivityName() . " is not a TaskInterface"); } $obj->execute($event); }