-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDispatchAfterRunTask.php
More file actions
38 lines (34 loc) · 1002 Bytes
/
DispatchAfterRunTask.php
File metadata and controls
38 lines (34 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php declare(strict_types=1);
namespace Torr\TaskManager\Task\DispatchAfterRunTask;
use Symfony\Component\Messenger\Attribute\AsMessage;
use Torr\TaskManager\Task\Task;
use Torr\TaskManager\Task\TaskManagerInternalTask;
use Torr\TaskManager\Task\TaskMetaData;
use Torr\TaskManager\Transport\TransportsHelper;
/**
* This task takes another task and puts it into the queue.
*
* This task is supposed to be worked on synchronously, as it is pretty lightweight and only
* redispatches the given task.
*/
#[AsMessage(transport: TransportsHelper::INTERNAL_TRANSPORT_NAME)]
readonly class DispatchAfterRunTask extends Task implements TaskManagerInternalTask
{
public function __construct (
public Task $task,
public array|string $transportNames = [],
)
{
parent::__construct();
}
/**
*
*/
#[\Override]
public function getMetaData () : TaskMetaData
{
return new TaskMetaData(
\sprintf("Redispatch task '%s' after the current run", $this->task->getMetaData()->label),
);
}
}