Skip to content

Commit 2631710

Browse files
authored
Merge pull request #11 from webandco/feature/ignore-nonexisting-configured-task
TASK: TaskCollectionFactory ignores non existing configured handlerCass
2 parents 278e267 + 129b09a commit 2631710

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎Classes/Domain/Task/TaskCollectionFactory.php‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55

66
use Cron\CronExpression;
77
use Neos\Flow\Annotations as Flow;
8+
use Neos\Flow\Log\Utility\LogEnvironment;
9+
use Psr\Log\LoggerInterface;
810

911
/**
1012
* @Flow\Scope("singleton")
1113
*/
1214
class TaskCollectionFactory
1315
{
16+
/**
17+
* @Flow\Inject
18+
* @var LoggerInterface
19+
*/
20+
protected $systemLogger;
1421

1522
/**
1623
* @Flow\InjectConfiguration(package="Flowpack.Task", path="tasks")
@@ -32,6 +39,11 @@ public function buildTasksFromConfiguration(): TaskCollection
3239
$cronExpressionPattern = $taskConfiguration['cronExpression'] ?? '';
3340
$cronExpression = $cronExpressionPattern !== '' ? new CronExpression($cronExpressionPattern) : null;
3441

42+
if (!class_exists($taskConfiguration['handlerClass'])) {
43+
$this->systemLogger->info(sprintf('Taskhandler class not found - Task "%s" is ignored', $taskConfiguration['handlerClass']), LogEnvironment::fromMethodName(__METHOD__));
44+
continue;
45+
}
46+
3547
$this->taskCollection->set($taskIdentifier, new Task(
3648
$taskIdentifier,
3749
$cronExpression,

0 commit comments

Comments
 (0)