简体   繁体   English

消费者有没有办法向使用 kafka(kafka.js) 和 node.js 实现的生产者发送确认?

[英]Is there any way for a Consumer to send an acknowledgement to a producer implemented using kafka(kafka.js) and node.js?

I believe the 3 types of acknowledgement as the producer properties are limited to the leader and the producer, I want the producer to receive a concrete message when the consumer consumes a message from the storage/queue through kafka broker.我相信作为生产者属性的 3 种类型的确认仅限于领导者和生产者,我希望生产者在消费者通过 kafka 代理消费来自存储/队列的消息时接收到具体消息。 Also correct me if I am wrong on the ' acks ' property of the producer, it's default is '-1' which acknowledges whether all the replicas have received/stored the message, but does it have anything to do with the consumer, or can we create a bridge when the consumer commits and kafka sends acknowledgement to producer?如果我对生产者的“ acks ”属性有误,也请纠正我,默认为“-1”,它确认所有副本是否已接收/存储消息,但它与消费者有什么关系,或者可以当消费者提交并且kafka向生产者发送确认时,我们创建了一个桥梁?

Consumer and Producer are isolated components and there is no out of the box acknowledgement framework between the two in the Kafka API; Consumer 和 Producer 是独立的组件,Kafka API 中两者之间没有开箱即用的确认框架; you'd have to implement this on your own你必须自己实现这个

Your understanding of the acks is correct, but has no control over consumer behavior, which always reads from the leader partition when message becomes available您对 acks 的理解是正确的,但无法控制消费者行为,当消息可用时,消费者行为总是从领导分区读取

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM