Conditions | 6 |
Paths | 10 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
32 | public function produce($messages) |
||
33 | { |
||
34 | $this->selfCheck(); |
||
35 | |||
36 | $channel = $this->getChannel(); |
||
37 | foreach ($messages as $payload) { |
||
38 | if ($this->isExchange()) { |
||
39 | $channel->batch_basic_publish($this->createMessage($payload), $this->exchange->getName()); |
||
40 | } else { |
||
41 | $channel->batch_basic_publish($this->createMessage($payload), '', $this->queue->getName()); |
||
42 | } |
||
43 | |||
44 | $this->queued++; |
||
45 | |||
46 | if ($this->limit && $this->limit <= $this->queued) { |
||
47 | $this->flush(); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | if ($this->queued) { |
||
52 | $this->flush(); |
||
53 | } |
||
54 | } |
||
55 | |||
62 |