arnaud-lb / php-rdkafka

Production-ready, stable Kafka client for PHP
MIT License
2.08k stars 263 forks source link

Exception : RdKafka\Metadata::__construct() has not been called #530

Open daavelar opened 2 years ago

daavelar commented 2 years ago

Description

The following code:

<?php

$metadata = new Metadata;
$metadata->getTopics()

Resulted in this output:

Exception : RdKafka\Metadata::__construct() has not been called

But I expected to get the topics list.

php-rdkafka Version

php-rdkafka 6.0.3

librdkafka Version

1.8.2~1confluent7.2.1-1

PHP Version

php 8.1.8

Operating System

Ubuntu 22.04

Kafka Version

2.6.3

nick-zh commented 2 years ago

This might be misleading, you need to call an RdKafka or KafkaConsumer instance to get metadata, see doc Maybe docs or examples can be improved to make this more clear