1 | <?php |
||
12 | class Consumer implements ConsumerInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var ConnectionInterface |
||
16 | */ |
||
17 | private $connection; |
||
18 | |||
19 | /** |
||
20 | * @var ChannelInterface |
||
21 | */ |
||
22 | private $channel; |
||
23 | |||
24 | /** |
||
25 | * @var callable |
||
26 | */ |
||
27 | private $callback; |
||
28 | |||
29 | /** |
||
30 | * @var callable |
||
31 | */ |
||
32 | private $restartCheckCallable; |
||
33 | |||
34 | 4 | public function __construct(ConnectionInterface $connection, string $channelId = '') |
|
39 | |||
40 | 1 | public function setCallback(callable $callback = null) |
|
44 | |||
45 | 1 | public function setRestartCheckCallable(callable $callable) |
|
49 | |||
50 | 2 | public function consume(Consumable $consumable) |
|
59 | |||
60 | 1 | public function getMessage(Consumable $consumable) : QueuedMessage |
|
64 | |||
65 | 1 | public function getChannel() : ChannelInterface |
|
66 | { |
||
67 | 1 | return $this->channel; |
|
68 | } |
||
69 | |||
70 | 1 | public function process(AMQPMessage $message) |
|
78 | |||
79 | 1 | public function getSize($queue) : int |
|
80 | { |
||
81 | 1 | $queueParams = new Queue( |
|
82 | $queue, |
||
83 | 1 | '', |
|
84 | 1 | null, |
|
85 | 1 | true |
|
86 | ); |
||
87 | |||
88 | 1 | return $this->channel->getQueueSize($queueParams); |
|
89 | } |
||
90 | |||
91 | 1 | private function checkRestart(QueuedMessageInterface $queuedMessage) |
|
97 | } |
||
98 |