2

When we talk about sourcing events , we have have a simple dual write architecture where we can write to database and we can write the events to a queue like Kafka . Other downstream system can read those events and act/use on it accordingly.

But the problem occurs when trying to make both DB and Events in sync as ordering of these events are required to make sense out of it.

To solve these problem people encouraging to use Database commit logs as source of events , and there are tools build around it like, Airbnb's Spinal Tap, Redhat's Debezium , Oracle's Golden gate etc .. It solves the problem of consistency, ordering guaranty and all these.

But the problem with use the Database commit log as event source is we are tightly coupling with DB schema. DB schemas for a micro-service is exposed , and any breaking changes in DB schema like datatype change / col name change can actually break the downstream systems.

So is using DB CDC as event source is good idea ?

A talk on these problem and using debezium for event sourcing

1

But the problem with use the Database commit log as event source is we are tightly coupling with DB schema. DB schemas for a micro-service is exposed , and any breaking changes in DB schema like datatype change / col name change can actually break the downstream systems.

That's so. However, it's not any different from the sorts of problems you face sharing data when you aren't event sourcing.

Which is to say, producer and consumer need to agree on a contract between them. And if you want the contract to be viable long term, then you need to invest in its design so that the contract is decoupled from the volatile portions of the implementation.

That could be an RDBMS - but instead of coupling the consumer to a specific table schema, you give them access to a view, or stored procedure. Or you could create a web endpoint, or a document store, and have your consumers read from that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.