<?php

namespace App\Shared\Event\MessageHandler;

use App\Shared\Event\Message\PublishDomainEventsMessage;
use App\Shared\Event\Service\OutboxPublisher;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
final class PublishDomainEventsHandler
{
    public function __construct(private readonly OutboxPublisher $publisher) {}

    public function __invoke(PublishDomainEventsMessage $message): void
    {
        $this->publisher->publish();
    }
}
