feat(kafka): 添加消费者配置参数以优化消息拉取行为
新增 fetchMaxBytes、fetchMinBytes 和 fetchMaxWaitMs 配置项,允许更精细地控制消费者从 Kafka 拉取消息的行为,从而优化网络利用率和消费延迟。
This commit is contained in:
@@ -55,6 +55,9 @@ class KafkaConsumer {
|
|||||||
fromOffset: this.config.fromOffset ?? 'latest',
|
fromOffset: this.config.fromOffset ?? 'latest',
|
||||||
encoding: 'buffer',
|
encoding: 'buffer',
|
||||||
keyEncoding: 'buffer',
|
keyEncoding: 'buffer',
|
||||||
|
fetchMaxBytes: this.config.fetchMaxBytes,
|
||||||
|
fetchMinBytes: this.config.fetchMinBytes,
|
||||||
|
fetchMaxWaitMs: this.config.fetchMaxWaitMs,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.config?.sslEnabled === true) {
|
if (this.config?.sslEnabled === true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user