???? ??? ?? ? ?? ????????. ???? ??? ? ?? ??? ????????. ??? ??? ?????? ??? ? ? ????.
??? ???
<?phptry { $rcf = new RdKafka\Conf(); $rcf->set('group.id', 'test'); $cf = new RdKafka\TopicConf(); $cf->set('offset.store.method', 'broker'); $cf->set('auto.offset.reset', 'smallest'); $rk = new RdKafka\Producer($rcf); $rk->setLogLevel(LOG_DEBUG); $rk->addBrokers("127.0.0.1"); $topic = $rk->newTopic("test", $cf); for($i = 0; $i < 1000; $i++) { $topic->produce(0,0,'test' . $i);//沒(méi)有setMessge接口了,使用produce 參考:https://libraries.io/github/mentionapp/php-rdkafka } } catch (Exception $e) { echo $e->getMessage();
??? ??
<?phptry { $rcf = new RdKafka\Conf(); $rcf->set('group.id', 'test'); $cf = new RdKafka\TopicConf();/* $cf->set('offset.store.method', 'file'); */ $cf->set('auto.offset.reset', 'smallest'); $cf->set('auto.commit.enable', true); $rk = new RdKafka\Consumer($rcf); $rk->setLogLevel(LOG_DEBUG); $rk->addBrokers("127.0.0.1"); $topic = $rk->newTopic("test", $cf); //$topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING); while (true) { $topic->consumeStart(0, RD_KAFKA_OFFSET_STORED); $msg = $topic->consume(0, 1000); var_dump($msg); if ($msg->err) { echo $msg->errstr(), "\n"; break; } else { echo $msg->payload, "\n"; } $topic->consumeStop(0); sleep(1); } } catch (Exception $e) { echo $e->getMessage(); }
? ???? ?? ???? ???? ????? ?? ???? ????? ????????. ?????? ???? ?? ??????! ? ???? ?? ???? ?? ?????? ?????. ??? ???? ???? ??? ????. ??? ??? ?? ??? ?? ??? ???? ????! ??? ?? ?? ??? ???? ????? ????. ???: admin@php.cn
?? ??

01 Dec 2024
Rails ?????? ??: MySQL ????? ????? ?? ??? Rails ??????? ?????? ??? ????? ??...

30 Oct 2024
?? ? ????? ????? ? ?? ???: ?? ?? PHP? mysql_connect ??? ???? ??????? ??? ??? ?...

25 Dec 2024
MySQL2 Gem: MySQL ????? ?????? ??? ?? ?? ?? "??? MySQL ????? ????? ??" ???? возникает

02 Dec 2024
Rails ?????? MySQL ?? ??Rails ??????? ?? MySQL ??? ????? ?? ??? ??? ? ????:???...

31 Oct 2024
?? ?? ???: ??? ?? ??????? ?????? ?? ???? ??? ???? ?? ????...

30 Oct 2024
?? ? ????? ????? ? ?? ???: mysqlnd? ???????. ? ??? ????? ???? "?? ?..." ??? ?????.


??? ??

??? ?? ????? PHP ?????
??? ?? ????? PHP ?????

50?? ??? ??? PHP ???? ??
??? PHP ????, ??? ????? ??? ???? ?????

??? ???? ?? ?? PHP ?????
??? ???? ?? ?? PHP ?????
