Comments (6)
$consumer is object ?
metadata.broker.list must like this, 127.0.0.1:port
from php-rdkafka.
it's not the problem.
I found the code not registered function newTopic in file kafka_consumer.c
PHP_ME(RdKafka__KafkaConsumer, newTopic, arginfo_kafka_kafka_consumer_new_topic, ZEND_ACC_PUBLIC)
in line 635 It is that:
static const zend_function_entry fe[] = { /* {{{ */
PHP_ME(RdKafka__KafkaConsumer, __construct, arginfo_kafka_kafka_consumer___construct, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, assign, arginfo_kafka_kafka_consumer_assign, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, getAssignment, arginfo_kafka_kafka_consumer_getAssignment, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, commit, arginfo_kafka_kafka_consumer_commit, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, commitAsync, arginfo_kafka_kafka_consumer_commit_async, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, consume, arginfo_kafka_kafka_consumer_consume, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, subscribe, arginfo_kafka_kafka_consumer_subscribe, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, getSubscription, arginfo_kafka_kafka_consumer_getSubscription, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, unsubscribe, arginfo_kafka_kafka_consumer_unsubscribe, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, getMetadata, arginfo_kafka_kafka_consumer_getMetadata, ZEND_ACC_PUBLIC)
PHP_ME(RdKafka__KafkaConsumer, __destruct, arginfo_kafka_kafka_consumer___destruct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
PHP_FE_END
}; /* }}} */
from php-rdkafka.
@breath-co2 high level interface use subscribe like this:
$this->rk = new \RdKafka\KafkaConsumer($this->conf);
$this->rk->subscribe([$topic]);
newTopic is simple insterface. the code at rdkafka.c
from php-rdkafka.
@doubleycn I need get object \RdKafka\KafkaConsumerTopic
https://arnaud-lb.github.io/php-rdkafka/phpdoc/class.rdkafka-kafkaconsumertopic.html
The document page write that:
This class represents a topic when using the RdKafka\KafkaConsumer. It can not be instantiated directly, RdKafka\KafkaConsumer::newTopic() should be used instead.
from php-rdkafka.
@breath-co2 do you want to use RdKafka\KafkaConsumerTopic::offsetStore ? you can use this methed.
`
ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_kafka_consumer_commit, 0, 0, 0)
ZEND_ARG_INFO(0, message_or_offsets)
ZEND_END_ARG_INFO()
PHP_METHOD(RdKafka__KafkaConsumer, commit)
{
consumer_commit(0, INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
example:
$conf = new RdKafka\Conf();
$conf->set("metadata.broker.list", "xxxx:8092");
$conf->set("group.id", "test-group");
//$conf->set("enable.auto.commit", "false");
//$conf->set("enable.auto.offset.store", "false");
//$conf->set("auto.offset.reset", 'smallest');
$consumer = new RdKafka\KafkaConsumer($conf);
$consumer->subscribe(["test"]);
while (true) {
$message = $consumer->consume(100e2);
switch ($message->err) {
case RD_KAFKA_RESP_ERR_NO_ERROR:
$consumer->commit($message);
var_dump($message);
break;
case RD_KAFKA_RESP_ERR__PARTITION_EOF:
break;
default:
var_dump($message->errstr());
}
break;
}
`
if not.I can't help you! wait author!
from php-rdkafka.
@doubleycn Yes, I see, thank you very much.
from php-rdkafka.
Related Issues (20)
- No current leader for partition
- Producer don't send message to another broker when main broker is down HOT 1
- Cannot produce message
- Failed to install the extension with PECL on Mac(M1 chip) HOT 1
- Compile error with php-rdkafka 6.0.1 and librdkafa 1.9.0 at php 8.0 HOT 1
- Batch processing HOT 5
- Force Init Connection HOT 7
- TypeError KafkaConsumer::getMetadata HOT 1
- Getting librdkafka builtin features HOT 1
- Add RdKafka\Conf::get() method
- Exception : RdKafka\Metadata::__construct() has not been called HOT 1
- PHP 8.2 build, please? HOT 4
- ASAN reports memleaks for tests/bug330.phpt
- How to ensure that all offsets are committed successfully when commit manually
- Deprecations when compiling on php 8.3
- Can't install extension on macOS via PECL HOT 1
- Leaving group using High-level consumer
- On Load Testing with K6, php app Fails to Connect to kafka after a fixed number (~28000) of publishes. Will work again, but only after a minute. HOT 1
- High-Level Consumer set offset
- Problem installing PHP 8.3 extension on Windows HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-rdkafka.