From bbca197ca5a6b42ca46d4c2851fc8d57508a7234 Mon Sep 17 00:00:00 2001 From: niuf416 Date: Thu, 10 Oct 2024 11:17:39 +0800 Subject: [PATCH] fix:Convert KAFKA_CONSUMER_DEFAULT_TIMEOUT to an integer to avoid type error If KAFKA_CONSUMER_DEFAULT_TIMEOUT is configured in the .env file, it will result in an error RdKafka\KafkaConsumer::consume(): Argument #1 ($timeout_ms) must be of type int, string given --- src/Consumers/Consumer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Consumers/Consumer.php b/src/Consumers/Consumer.php index 711d0cb..eb0828b 100644 --- a/src/Consumers/Consumer.php +++ b/src/Consumers/Consumer.php @@ -191,7 +191,7 @@ public function consumedMessagesCount(): int */ private function doConsume(): void { - $message = $this->consumer->consume(config('kafka.consumer_timeout_ms', 2000)); + $message = $this->consumer->consume((int) config('kafka.consumer_timeout_ms', 2000)); $this->handleMessage($message); }