Conditions | 7 |
Paths | 28 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function run($nonBlocking = false) |
||
38 | { |
||
39 | if (empty($this->queues)) { |
||
40 | $queues = $this->client->getQueues(); |
||
41 | } else { |
||
42 | $queues = $this->queues; |
||
43 | } |
||
44 | |||
45 | foreach ($queues as $queue) { |
||
46 | /* @var Queue $queue */ |
||
47 | $queue->consume(); |
||
48 | } |
||
49 | |||
50 | $channel = $this->client->getChannel(); |
||
51 | if ($nonBlocking) { |
||
52 | if (count($channel->callbacks)) { |
||
53 | $channel->wait(null, true); |
||
54 | } |
||
55 | } else { |
||
56 | while (count($channel->callbacks)) { |
||
57 | $channel->wait(); |
||
58 | } |
||
59 | } |
||
60 | |||
61 | foreach ($queues as $queue) { |
||
62 | /* @var Queue $queue */ |
||
63 | $queue->cancelConsume(); |
||
64 | } |
||
65 | } |
||
66 | } |
||
67 |