Apache kafka 如何使用卡夫卡处理以下问题

Apache kafka 如何使用卡夫卡处理以下问题,apache-kafka,Apache Kafka,假设我有以下情况 producer sends the following instructions on to kafka : 1. "debit 100 from account A" 2. "send email to user A that his account is debited by 100" and there is a consumer that does the following : 1. does the actual work of 'debit 100' 2. d

假设我有以下情况

producer sends the following instructions on to kafka : 
1. "debit 100 from account A"
2. "send email to user A that his account is debited by 100"
and there is a consumer that does the following :
1. does the actual work of 'debit 100'
2. does the actual work of 'sending mail'
比如说,consumer实例崩溃了,我提出了另一个实例。 现在,消费者告诉卡夫卡“重播”(具体化其数据视图) 就现实世界而言,消费者不应该按照这些指示行事(这将导致不必要的借记和电子邮件),而应该阅读数据,并采取一切必要措施来实现其观点


问题是,消费者如何知道自己之前对某条消息“采取了行动”,所以不应该再对其采取行动。它只需要在内部捕获消息状态信息?

您可以做的一件事是让消费者手动提交偏移量。为此,您需要将默认的使用者配置
enable.auto.commit
true
更改为
false
。然后,在使用者应用程序中,在成功处理消息后,提交偏移量。

您可以做的一件事是让使用者手动提交偏移量。为此,您需要将默认的使用者配置
enable.auto.commit
true
更改为
false
。然后,在消费者应用程序中,在成功处理消息后,提交偏移量