This commit is contained in:
2020-10-28 16:31:04 +08:00
parent 6fda19d2bc
commit d028da2dd0
+4 -1
View File
@@ -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]);
}