1 | <?php |
||
14 | class QueueReader implements DomainQueueReader |
||
15 | { |
||
16 | /** |
||
17 | * @var SqsClient |
||
18 | */ |
||
19 | protected $sqs; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $queueUrl; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | protected $messagesToRead; |
||
30 | |||
31 | /** |
||
32 | * @var MessageHandler |
||
33 | */ |
||
34 | protected $messageHandler; |
||
35 | |||
36 | /** |
||
37 | * @var LoggerInterface |
||
38 | */ |
||
39 | protected $logger; |
||
40 | |||
41 | /** |
||
42 | * @param SqsClient $sqs |
||
43 | * @param string $queueUrl |
||
44 | * @param int $messagesToRead |
||
45 | * @param MessageHandler $messageHandler |
||
46 | * @param LoggerInterface $logger |
||
47 | */ |
||
48 | public function __construct( |
||
61 | |||
62 | /** |
||
63 | * @param callable $callback |
||
64 | * @param int $timeout |
||
65 | * |
||
66 | * @throws GracefulStopException |
||
67 | * @throws ParseMessageException |
||
68 | * @throws ReaderException |
||
69 | * @throws TimeoutReaderException |
||
70 | */ |
||
71 | public function read(callable $callback, $timeout=0) |
||
88 | |||
89 | /** |
||
90 | * Deletes all messages from the queue |
||
91 | */ |
||
92 | public function purge() |
||
98 | |||
99 | /** |
||
100 | * @param int $timeout |
||
101 | * |
||
102 | * @throws ReaderException |
||
103 | * @throws TimeoutReaderException |
||
104 | * @throws ParseMessageException |
||
105 | */ |
||
106 | protected function consume($timeout) |
||
127 | } |
||
128 |