Repository navigation
Idempotent consumers: a library that dedupes on topic:partition:offset #2323
Violetta Pidvolotska (violetta98)
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello everyone!
I got tired of writing the same dedup code in every consumer and getting it slightly wrong, so I packaged it.
In your poll loop,
consumer.dispatch_sync(msg)tells you whether to commit or leave the message. It doesn't import the Kafka SDK, you create the client yourself.Why a "processed offsets" set isn't enough: it lets two consumers check at the same time, both see nothing, and both run. Here only one can win. It also handles a consumer dying mid-message without leaving the offset stuck.
https://github.com/idemkit/idemkit, Apache-2.0
If it's useful, I'd appreciate a star. It's new, so visibility helps a lot right now.
All reactions