KafkaConsumer example

public function testDumpKafkaConsumer()
    {
        if (!$this->hasBroker) {
            $this->markTestSkipped('Test requires an active broker');
        }

        $conf = new Conf();
        $conf->set('metadata.broker.list', $this->broker);
        $conf->set('group.id', self::GROUP_ID);

        $consumer = new KafkaConsumer($conf);
        $consumer->subscribe([self::TOPIC]);

        $expectedDump = <<<EODUMP RdKafka\KafkaConsumer { %Asubscription: array:1 [ 0 => "test-topic" ] assignment: [] orig_broker_id: %i orig_broker_name: "$this->broker/%s" brokers: RdKafka\Metadata\Collection { +0: RdKafka\Metadata\Broker { id: 1001 host: "%s" port: %d } } topics: RdKafka\Metadata\Collection { +0: RdKafka\Metadata\Topic { name: "%s" partitions: RdKafka\Metadata\Collection { +0: RdKafka\Metadata\Partition { id: 0 err: 0 leader: 1001 }%A } }%A } }
Home | Imprint | This part of the site doesn't use cookies.