0

为什么我得到错误kafka.Client不是构造函数,同时npm kafka-node这是创建kafka连接的方式?

具体有问题的行是:this.client = new kafka.Client();
整个构造函数是:

constructor(){
    this.Producer = kafka.Producer,
    this.client = new kafka.Client();
    this.producer = new Producer(client);
}
4

1 回答 1

1

该问题的解决方案如下。通过此实现,代码按预期工作:

    constructor(){
        this.Producer = kafka.Producer,
        this.client = new kafka.KafkaClient();
        this.producer = new kafka.Producer(this.client);
}
于 2020-07-03T19:02:36.033 回答