From fa53f4f85f6f6f5f1a374133f1b382cd9928fd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E7=BA=B5?= <5262097@qq.com> Date: Tue, 6 Nov 2018 10:25:13 +0800 Subject: [PATCH] setMaxBytes --- src/ConsumerConfig.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ConsumerConfig.php b/src/ConsumerConfig.php index eab43d9b..8a394957 100644 --- a/src/ConsumerConfig.php +++ b/src/ConsumerConfig.php @@ -152,4 +152,18 @@ public function getConsumeMode(): int { return $this->runtimeOptions['consume_mode']; } + + /** + * @param int $maxBytes + * + * @throws \Kafka\Exception\Config + */ + public function setMaxBytes(int $maxBytes): void + { + if ($maxBytes < 1000 || $maxBytes > 1000000000) { + throw new Exception\Config('Set consumer maxBytes value is invalid, must set it 1000 .. 1000000000'); + } + + static::$options['maxBytes'] = $maxBytes; + } }