WorkerMessageReceivedEvent.php 744 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Messenger\Event;
  11. /**
  12. * Dispatched when a message was received from a transport but before sent to the bus.
  13. *
  14. * The event name is the class name.
  15. */
  16. final class WorkerMessageReceivedEvent extends AbstractWorkerMessageEvent
  17. {
  18. private $shouldHandle = true;
  19. public function shouldHandle(bool $shouldHandle = null): bool
  20. {
  21. if (null !== $shouldHandle) {
  22. $this->shouldHandle = $shouldHandle;
  23. }
  24. return $this->shouldHandle;
  25. }
  26. }