You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by fuyou <fu...@gmail.com> on 2017/07/02 06:28:11 UTC

about Exactly-once Semantics

I read the great blog about kafka Exactly-once Semantics
<https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/>
.
my question is when consumer receive msg,and process the msg  result save
to db(eg.MySQL),how to keep Exactly-once Semantics.

I think the kafka Exactly-once Semantics useful when consumer  process the
msg result save to kafka.

am i right ?

thanks .
-- 
   =============================================

  fuyou001
Best Regards

Re: about Exactly-once Semantics

Posted by Hans Jespersen <ha...@confluent.io>.
When you write the msg results to MySQL, you include the offset of the message with the results. This can be done in one atomic write transaction. Then if your application crashes, when it starts back up, it should read the offset stored with the last message results in the database, then seek() to that offset, and continue consuming with exactly once semantics.

This is how many of the exactly once Kafka Connect Sink Connectors work today.

-hans

> On Jul 1, 2017, at 11:28 PM, fuyou <fu...@gmail.com> wrote:
> 
> I read the great blog about kafka Exactly-once Semantics
> <https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/>
> .
> my question is when consumer receive msg,and process the msg  result save
> to db(eg.MySQL),how to keep Exactly-once Semantics.
> 
> I think the kafka Exactly-once Semantics useful when consumer  process the
> msg result save to kafka.
> 
> am i right ?
> 
> thanks .
> -- 
>   =============================================
> 
>  fuyou001
> Best Regards