|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Enqueue\Consumption\Context; |
| 4 | + |
| 5 | +use Enqueue\Consumption\Result; |
| 6 | +use Interop\Queue\Context; |
| 7 | +use Interop\Queue\Message; |
| 8 | +use Psr\Log\LoggerInterface; |
| 9 | + |
| 10 | +final class PostMessageReceived |
| 11 | +{ |
| 12 | + /** |
| 13 | + * @var Context |
| 14 | + */ |
| 15 | + private $context; |
| 16 | + |
| 17 | + /** |
| 18 | + * @var Message |
| 19 | + */ |
| 20 | + private $message; |
| 21 | + |
| 22 | + /** |
| 23 | + * @var LoggerInterface |
| 24 | + */ |
| 25 | + private $logger; |
| 26 | + |
| 27 | + /** |
| 28 | + * @var int |
| 29 | + */ |
| 30 | + private $receivedAt; |
| 31 | + |
| 32 | + /** |
| 33 | + * @var Result|string|object|null |
| 34 | + */ |
| 35 | + private $result; |
| 36 | + |
| 37 | + /** |
| 38 | + * @var bool |
| 39 | + */ |
| 40 | + private $executionInterrupted; |
| 41 | + |
| 42 | + public function __construct( |
| 43 | + Context $context, |
| 44 | + Message $message, |
| 45 | + $result, |
| 46 | + int $receivedAt, |
| 47 | + LoggerInterface $logger |
| 48 | + ) { |
| 49 | + $this->context = $context; |
| 50 | + $this->message = $message; |
| 51 | + $this->result = $result; |
| 52 | + $this->receivedAt = $receivedAt; |
| 53 | + $this->logger = $logger; |
| 54 | + |
| 55 | + $this->executionInterrupted = false; |
| 56 | + } |
| 57 | + |
| 58 | + public function getContext(): Context |
| 59 | + { |
| 60 | + return $this->context; |
| 61 | + } |
| 62 | + |
| 63 | + public function getMessage(): Message |
| 64 | + { |
| 65 | + return $this->message; |
| 66 | + } |
| 67 | + |
| 68 | + public function getLogger(): LoggerInterface |
| 69 | + { |
| 70 | + return $this->logger; |
| 71 | + } |
| 72 | + |
| 73 | + public function getReceivedAt(): int |
| 74 | + { |
| 75 | + return $this->receivedAt; |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * @return Result|null|object|string |
| 80 | + */ |
| 81 | + public function getResult() |
| 82 | + { |
| 83 | + return $this->result; |
| 84 | + } |
| 85 | + |
| 86 | + public function isExecutionInterrupted(): bool |
| 87 | + { |
| 88 | + return $this->executionInterrupted; |
| 89 | + } |
| 90 | + |
| 91 | + public function interruptExecution(): void |
| 92 | + { |
| 93 | + $this->executionInterrupted = true; |
| 94 | + } |
| 95 | +} |
0 commit comments