Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

Transactions in Kafka is similar to Transactions in regular databases.

Code Block
breakoutModewide
languagejava
producer.beginTransaction();
producer.send(new ProducerRecord<>("A", "...", "..."));
producer.send(new ProducerRecord<>("B", "...", "..."));
producer.sendOffsetsToTransaction(offsets, group); // commit offsets in the topic a consumer is reading from
producer.commitTransaction();