Grokking Kafka and Event-Driven Architecture
0% completed
Consumers That Tolerate Repeats
This is the method the store's points ledger used to credit loyalty points:
static void plainIncrement(Connection db, ConsumerRecord<String, String> r) throws SQLException { try (var add = db.prepareStatement("UPDATE accounts_plain SET points = points + ? WHERE customer_id = ?")) { add.setInt(1, points(r)); add.setString(2, r.key()); add.executeUpdate(); } }
It is correct for every event delivered exactly once, and wrong for every event delivered twice
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%