问题描述
我希望具有完全一次的语义,但是我不想与Consumer一起阅读消息.我宁愿使用Kafka Streams AP阅读消息.如果我在Stream配置中添加 processing.guarantee = exactly_once ,会保留一次精确的语义吗?
I would like to have Exactly-once semantics, but I don't want to read message with Consumer. I'd rather read messages with Kafka Streams AP. If I add processing.guarantee=exactly_once to Stream configuration, will exactly-once semantics be kept?
推荐答案
一次处理是基于读写过程的模式. Kafka Streams使用此模式,因此,如果您编写一个常规的Kafka Streams应用程序,将结果写回到Kafka主题,则将获得一次精确的处理保证.
Exactly-once processing is based on a read-process-write pattern. Kafka Streams uses this pattern and thus, if you write a regular Kafka Streams application that writes the result back to a Kafka topic, you will get exactly-once processing guarantees.
请注意,此保证不涵盖副作用.另请注意,如果发生故障,内部可能会重试.恰好一次暗示着,您在输出主题中看到的结果与没有错误(因此不会重试)的发生是相同的.
Note, that side-effects are not covered by this guarantee. Also note, that there might be retries internally in case of failure. Exactly-once implies, that the result you see in the output topic, is the same as if no error (and thus not retries) would have happened.
有关更多详细信息,您可能想观看有关Kafka中一次担保的谈话记录. Confluent网页(免责声明:我是Confluent的雇员)中有多个可用项: https://www.confluent.io/resources/
For more details, you might want to watch a talk recording about exactly-once guarantees in Kafka. There are multiple available at Confluent webpage (disclaimer: I am an employee at Confluent): https://www.confluent.io/resources/
这篇关于如果我在Kafka中有Transactional Producer,我可以使用Kafka Streams准确地阅读一次消息吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!