]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/nmred/kafka-php/src/Kafka/Protocol/Fetch/Helper/Consumer.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / nmred / kafka-php / src / Kafka / Protocol / Fetch / Helper / Consumer.php
1 <?php
2 namespace Kafka\Protocol\Fetch\Helper;
3 /**
4  * Description of Consumer
5  *
6  * @author daniel
7  */
8 class Consumer extends HelperAbstract
9 {
10     protected $consumer;
11
12     protected $offsetStrategy;
13
14     /**
15      * Consumer constructor.
16      * @param \Kafka\Consumer $consumer
17      */
18     public function __construct(\Kafka\Consumer $consumer)
19     {
20         $this->consumer = $consumer;
21     }
22
23     /**
24      * @param \Kafka\Protocol\Fetch\Partition $partition
25      */
26     public function onPartitionEof($partition)
27     {
28         $partitionId = $partition->key();
29         $topicName = $partition->getTopicName();
30         $offset    = $partition->getMessageOffset();
31         $this->consumer->setFromOffset(true);
32         $this->consumer->setPartition($topicName, $partitionId, ($offset +1));
33     }
34
35     /**
36      * @param string $streamKey
37      */
38     public function onStreamEof($streamKey)
39     {
40
41     }
42
43     /**
44      * @param string $topicName
45      */
46     public function onTopicEof($topicName)
47     {
48
49     }
50 }