How to pick a Kafka transaction.id

前端 未结 3 1453
梦谈多话
梦谈多话 2020-12-28 17:05

I wonder could I get some help understanding transactions in Kafka and in particular how I use transaction.id. Here\'s the context:

  1. My Kafka application follow
3条回答
  •  [愿得一人]
    2020-12-28 17:41

    When using the Streams API (in contrast to the regular Kafka producers) you do not have to worry about setting a unique transactional.id per instance of your stream application. When you enable Streams exactly_once semantics, the Streams API will generate the proper/ unique transactional.id based on the topic/ partition.

    Check this out what exactly is done here: https://github.com/axbaretto/kafka/blob/fe51708ade3cdf4fe9640c205c66e3dd1a110062/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java#L455

    The Task (referring to TaskId in the code) is explained here: https://docs.confluent.io/current/streams/architecture.html#stream-partitions-and-tasks

提交回复
热议问题