1 | <?php |
||
16 | class QueueReader implements DomainQueueReader |
||
17 | { |
||
18 | /** |
||
19 | * @var AMQPLazyConnection |
||
20 | */ |
||
21 | protected $connection; |
||
22 | |||
23 | /** |
||
24 | * @var QueueConfig |
||
25 | */ |
||
26 | protected $queueConfig; |
||
27 | |||
28 | /** |
||
29 | * @var ExchangeConfig |
||
30 | */ |
||
31 | protected $exchangeConfig; |
||
32 | |||
33 | /** |
||
34 | * @var BindConfig |
||
35 | */ |
||
36 | protected $bindConfig; |
||
37 | |||
38 | /** |
||
39 | * @var ConsumeConfig |
||
40 | */ |
||
41 | protected $consumeConfig; |
||
42 | |||
43 | /** |
||
44 | * @var MessageHandler |
||
45 | */ |
||
46 | protected $messageHandler; |
||
47 | |||
48 | /** |
||
49 | * @var LoggerInterface |
||
50 | */ |
||
51 | protected $logger; |
||
52 | |||
53 | /** |
||
54 | * @var AMQPChannel |
||
55 | */ |
||
56 | protected $channel; |
||
57 | |||
58 | /** |
||
59 | * QueueReader constructor. |
||
60 | * @param AMQPLazyConnection $connection |
||
61 | * @param QueueConfig $queueConfig |
||
62 | * @param ExchangeConfig $exchangeConfig |
||
63 | * @param BindConfig $bindConfig |
||
64 | * @param ConsumeConfig $consumeConfig |
||
65 | * @param MessageHandler $messageHandler |
||
66 | * @param LoggerInterface $logger |
||
67 | */ |
||
68 | public function __construct( |
||
86 | |||
87 | /** |
||
88 | * @param callable $callback |
||
89 | * @param int $timeout |
||
90 | * @throws ReaderException |
||
91 | * @throws TimeoutReaderException |
||
92 | */ |
||
93 | public function read(callable $callback, $timeout=0) |
||
108 | |||
109 | /** |
||
110 | * Deletes all messages from the queue |
||
111 | * @return void |
||
112 | */ |
||
113 | public function purge() |
||
118 | |||
119 | /** |
||
120 | * Creates the exchange |
||
121 | */ |
||
122 | protected function exchangeDeclare() |
||
133 | |||
134 | /** |
||
135 | * Creates the queues and binds them to the exchanges and topics |
||
136 | */ |
||
137 | protected function queueDeclareAndBind() |
||
154 | |||
155 | /** |
||
156 | * Starts consuming from the queue |
||
157 | * @param int $timeout |
||
158 | */ |
||
159 | protected function consume($timeout) |
||
173 | |||
174 | /** |
||
175 | * @throws ReaderException |
||
176 | */ |
||
177 | protected function initialize() |
||
192 | |||
193 | /** |
||
194 | * Destructor |
||
195 | */ |
||
196 | public function __destruct() |
||
202 | } |