weiboad/kafka-php

unable producer to specific topic

afety opened this issue · 0 comments

afety commented

I use some code from Example to test send message to specific topic,

        $config = ProducerConfig::getInstance();
        $config->setMetadataRefreshIntervalMs(10000);
        $config->setMetadataBrokerList('127.0.0.1:9092');
        $config->setBrokerVersion('1.0.0');
        $config->setRequiredAck(1);

        $producer = new Producer(function () {
            return [
                [
                    'topic' => 'logTest',
                    'value' => 'test....message.',
                    'key' => '',
                ],
            ];
        });

then I receive any Fatal error: Requested topic "logTest" does not exist. Did you forget to create it?"

I am sure this topic exists,and this image is a screenshot of kafka-manager
企业微信截图_20191226143234