Menu

How I proved a Kafka consumer replayed the same offset after a PostgreSQL commit
πŸ“°

How I proved a Kafka consumer replayed the same offset after a PostgreSQL commit

DEV Community: javaΒ·Mostafa TavassoliΒ·about 8 hours ago
#YfUlgt2M
#devtojava#devto#dev#offset#test
Long article (1294 words) β€” no AI summary yet.
Reading 0:00
15s threshold

In an earlier experiment , the clearest result wasn't about the model at all. When the same support ticket was delivered twice, the agent made two audited follow-up calls, unless the application deduplicated them.

The deduplication in my demo was a Set in memory. That's fine for a demo. In production it has two problems:

It forgets on restart. If the consumer creates the follow-up and dies before acknowledging the message, Kafka delivers it again to a fresh process with an empty set. The follow-up call happens again.

It drops real work. It was keyed on the ticket, so a customer's second, genuine callback request on the same ticket was silently ignored.

So I added an opt-in mode that stores the follow-up as a database row, and then tried to break it by killing the consumer at the worst possible moment.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.