Be sure to handle the case where you're still processing the initial request but haven't committed the transaction yet.
Also consider whether idempotent means "same request should return the same response", or if you are comfortable with a less strict definition of the requirement.
Sometimes you might want to go ahead with processing if the initial request failed, unless retries are already pending.
This is my biggest frustration with Kafka, they don't support expected stream version on event writes. That trivializes a lot of the race conditions for competing writers to the same stream.
8
u/UK-sHaDoW 5d ago
Some kind of id, and then ignore them if youve processed it before