src/Subscriber/FailedMessageSubscriber.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Subscriber;
  3. use App\Service\MailerService;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
  6. class FailedMessageSubscriber implements EventSubscriberInterface
  7. {
  8.     public function __construct(private readonly MailerService $email)
  9.     {
  10.     }
  11.     public static function getSubscribedEvents(): array
  12.     {
  13.         return [
  14.             WorkerMessageFailedEvent::class => 'onMessageFailed'
  15.         ];
  16.     }
  17.     public function onMessageFailed(WorkerMessageFailedEvent $event)
  18.     {
  19.         $message $event->getEnvelope()->getMessage()::class;
  20.         $this->email->failedEncodeVideo('Problème sur l\'encodage d\'une vidéo');
  21.     }
  22. }