From d028da2dd0b5216d74fe8037b7809afd98b2a5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 28 Oct 2020 16:31:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kafka/Producer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Kafka/Producer.php b/Kafka/Producer.php index 162fe933..b44d5da2 100644 --- a/Kafka/Producer.php +++ b/Kafka/Producer.php @@ -106,9 +106,12 @@ class Producer extends Component $topic = $rk->newTopic($this->_topic, $this->topicConf); $topic->produce(RD_KAFKA_PARTITION_UA, 0, $message, $key); $rk->poll($timeout); + $rk->flush($timeout); $event = Snowflake::app()->getEvent(); - $event->on(Event::EVENT_AFTER_REQUEST, [$this, 'onFlush']); + $event->on(Event::EVENT_AFTER_REQUEST, function ($rk, $timeout) { + var_dump(func_get_args()); + }, [$rk, $timeout]); }