Total Complexity | 6 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class AmqpMessagePublisher |
||
12 | { |
||
13 | /** @var AMQPChannel */ |
||
14 | private $channel; |
||
15 | /** @var string */ |
||
16 | private $queue; |
||
17 | /** @var string */ |
||
18 | private $exchange; |
||
19 | /** @var int */ |
||
20 | private $batch = 0; |
||
21 | /** @var bool */ |
||
22 | private $persistant; |
||
23 | |||
24 | public function __construct(AMQPChannel $channel, string $queue, string $exchange, bool $persistant) |
||
25 | { |
||
26 | $this->channel = $channel; |
||
27 | $this->queue = $queue; |
||
28 | $this->exchange = $exchange; |
||
29 | $this->persistant = $persistant; |
||
30 | |||
31 | $this->channel->queue_declare($this->queue, false, $this->persistant, false, false); |
||
32 | $this->channel->queue_bind($this->queue, $this->exchange, $this->queue); |
||
33 | } |
||
34 | |||
35 | public function publish(string $message, int $batchCount) |
||
42 | } |
||
43 | } |
||
44 | |||
45 | public function finalize() |
||
46 | { |
||
47 | $this->flush(); |
||
48 | } |
||
49 | |||
50 | public function flush() |
||
51 | { |
||
52 | $this->channel->publish_batch(); |
||
53 | } |
||
54 | |||
55 | public function countMessages(): int |
||
58 | } |
||
59 | } |
||
60 |