vendor/shopware/core/Framework/MessageQueue/Handler/AbstractMessageHandler.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\MessageQueue\Handler;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Shopware\Core\Framework\MessageQueue\Exception\MessageFailedException;
  5. use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
  6. /**
  7.  * @deprecated tag:v6.5.0 - reason:reason:class-hierarchy-change - will be removed, use default symfony MessageSubscriberInterface instead
  8.  */
  9. #[Package('core')]
  10. abstract class AbstractMessageHandler implements MessageSubscriberInterface
  11. {
  12.     /**
  13.      * @param object $message
  14.      */
  15.     public function __invoke($message): void
  16.     {
  17.         try {
  18.             $this->handle($message);
  19.         } catch (MessageFailedException $messageFailedException) {
  20.             throw $messageFailedException;
  21.         } catch (\Throwable $e) {
  22.             throw new MessageFailedException($message, static::class, $e);
  23.         }
  24.     }
  25.     /**
  26.      * @param object $message
  27.      */
  28.     abstract public function handle($message): void;
  29.     /**
  30.      * @return iterable<int|string>
  31.      */
  32.     abstract public static function getHandledMessages(): iterable;
  33. }