Ensuring data consistency between EventStore and Sql

We currently have a task where we want to

  1. Make a change to our sql data
  2. Send out an event to eventstore about the change

These 2 operations should be synched, so that no event is emitted if the sql update fails and vice versa.

Do You have any good examples or documentation for how to achieve this?

In some old interview(2013) it was said that you supported distributed transactions, is this still the case?

Searched the topics, found another similar request where Greg noted that an example should exist somewhere,

I have not been able to find it, do you have a link for it?

Thank You

So there are a few questions you should consider.

1) providing the data is written in SQL when would it fail getting
written into event store?
2) If it did fail temporarily due to say a network could you use some
other mechanism like idempotency to write it later?

In general I would not recommend using distributed transactions in a
situation like this as there are often other mechanisms that you can
try to use first. You can support the idea but I would be attempting
to avoid it if possible.

Cheers,

Greg

https://gist.github.com/jen20/1de2dc287e880fd7f16c