Coder Social home page Coder Social logo

Comments (6)

mszarlinski avatar mszarlinski commented on June 15, 2024

I think events ordering and clock synchronisation in distributed systems is far harder topic than just generating timestamp on database node. For example, database can be replicated or sharded onto multiple nodes as well. There are already available solutions like vector clocks, but isn't it out of a scope of Spring Data?

from sos.

stefanocke avatar stefanocke commented on June 15, 2024

I am aware that I don't achieve something like 'global ordering' by the proposed improvements. But when using the sequence number instead of timestamp and by getting the sequence number after the insert statement for the aggregate (enforced by flush), I think it is at least guaranteed that the events for one aggregate are in the right order.

from sos.

stefanocke avatar stefanocke commented on June 15, 2024

By the way, we seem to agree that sos-restful has some flaws regarding event timestamps. So what is the solution you propose to make it work for 'real life'?

from sos.

stefanocke avatar stefanocke commented on June 15, 2024

I changed the description and title to make clear it is not my intention to get reliable timestamps.

from sos.

mszarlinski avatar mszarlinski commented on June 15, 2024

We should discuss what kind of consistency guarantees you need in the first place. Spring Data is an abstraction over diverse types of storage, including NoSQL databases as well. We should decide on application characteristic first, then come up with a solution.

from sos.

stefanocke avatar stefanocke commented on June 15, 2024

IMHO, sos-restful is an approach that is based on the transactional guarantees of a relational database. To be more specific: It relies on persisting the aggregate and the domain event within the same transaction. If the database does not support this, the sos-restful approach cannot be used.
For more details on this approach see also "Implementing Domain-Driven Design" by Vaughn Vernon. And there especially chapter 8, "Messaging Infrastructure Consistency".

To make clear: I am not talking about Spring Data at all (as you seem to assume in your comments). All I wrote is specific to the sos-restful example where JPA and a relational DB are used.

from sos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.