feat(kafka): 添加消费者配置参数以优化消息拉取行为

新增 fetchMaxBytes、fetchMinBytes 和 fetchMaxWaitMs 配置项,允许更精细地控制消费者从 Kafka 拉取消息的行为,从而优化网络利用率和消费延迟。
This commit is contained in:
2026-01-30 20:13:05 +08:00
parent ad270bd936
commit 299e8de921

View File

@@ -55,6 +55,9 @@ class KafkaConsumer {
fromOffset: this.config.fromOffset ?? 'latest',
encoding: 'buffer',
keyEncoding: 'buffer',
fetchMaxBytes: this.config.fetchMaxBytes,
fetchMinBytes: this.config.fetchMinBytes,
fetchMaxWaitMs: this.config.fetchMaxWaitMs,
};
if (this.config?.sslEnabled === true) {