feat(dump): run dump creation asynchronously via Messenger

This commit is contained in:
2026-09-14 22:00:26 +02:00
parent 0188a24278
commit 86069a51a3
2 changed files with 47 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php declare(strict_types=1);
namespace AeonDumpManager\MessageQueue\Handler;
use AeonDumpManager\MessageQueue\Message\CreateDumpMessage;
use AeonDumpManager\Service\DumpJobStatusService;
use AeonDumpManager\Service\DumpService;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
#[AsMessageHandler]
class CreateDumpHandler
{
public function __construct(
private readonly DumpService $dumpService,
private readonly DumpJobStatusService $jobStatus,
) {
}
public function __invoke(CreateDumpMessage $message): void
{
$jobId = $message->getJobId();
$this->jobStatus->markRunning($jobId);
try {
$this->dumpService->createAsync($jobId, $this->jobStatus);
} catch (\Throwable $exception) {
$this->jobStatus->markFailed($jobId, $exception->getMessage());
}
}
}
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
namespace AeonDumpManager\MessageQueue\Message;
use Shopware\Core\Framework\MessageQueue\AsyncMessageInterface;
class CreateDumpMessage implements AsyncMessageInterface
{
public function __construct(private readonly string $jobId)
{
}
public function getJobId(): string
{
return $this->jobId;
}
}