In order to guard
against processing the same input event twice, we are producing deterministic
event ids. We were hoping to take
advantage of the Event Store and its ability to do idempotent writes (as documentedhere); meaning if an event with the same event id is produced it will not
be written to the stream a second time.
In order to attain
this behavior, we have been using ExpectedVersion.Any. This has worked well until recently and we
have been experiencing some odd behavior where duplicate events are being
written. Reading the documentation
closer it does say
Idempotence is not guaranteed
if ExpectedVersion.Any is used. The chance of a duplicate event being
written is small, but it does exist
Very well, but using
the other values for expected version do not seem to provide idempotent writes
either. If an input event comes in a
second time, we produce resulting events with consistent event ids. But when writing to the stream the second
time we set expected version equals current version (attained from the reading
of the stream) and the events are written again.
I have several
questions
- Can I use the idempotent
features in eventstore to accomplish this? - If not, what do others do in
this situation? Does my
application code need to check for duplicate event ids and ignore the
writing. - What is the purpose of the
idempotence capability within Event Store? Based on the documentation, I am not sure how I would take advantage of it.
Thanks much,
Bernie