Comments (6)
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.
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.
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.
I changed the description and title to make clear it is not my intention to get reliable timestamps.
from sos.
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.
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)
- Improve README
- Upgrade to Spring Cloud 2.0 M4
- Improve Kafka message binding
- Order Repository should be hidden from "api" package, right ? HOT 2
- Drop custom ProjectingMessageConverter
- Cannot construct instance of OrderCompleted HOT 1
- Upgrade to Spring Boot 2.0 RC1
- Upgrade to Spring Cloud 2.0 M5
- Switch to published variant of Spring domain events library
- Upgrade to Spring Boot 2.0 RC2
- Upgrade to Spring Boot 2.0 GA
- Upgrade to Spring Boot 2.0.2
- Upgrade to Spring Boot 2.1
- Compilation fails since Upgrade to Spring Boot 2.1. HOT 1
- Switch to GitHub actions for build
- Remove leftovers from refactoring in REST events module
- Use Inventory instead of InventoryItemRepository in 00-monolith HOT 1
- Remove .factorypath from microlith module
- Upgrade to Spring Boot 2.0 M7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sos.