Comments (4)
Hi! Very good question, we should have put that in the readme.
Basically if we want to have eventual consistency between Book and Patron, we should have some way of retries, max retries policy and escalation. Currently it is done as in memory events database with scheduler
from library.
Hi @crorodriguezro! Thank you for your question. Let me answer it.
There are two mechanisms for domain event publishing are available. If we go for the first one, that is JustForwardDomainEventPublisher
then all events are sent synchronously so the update of both aggregates will be done synchronously. However, this is not an advised approach I we prefer to use eventual consistency between aggregates, what @pilloPl already mentioned.
The second solution, StoreAndForwardDomainEventPublisher
is based on scheduler, and the problem you mentioned is there - we might have a hold registered in Patron aggregate, while Book aggregate will still wait for it. In single app environment (one common in memory collection of events to send) if any of events causes the error, the whole batch will be rolled back. The next execution of scheduler will try to do it once more.
As it is described in the documentation, there is always a tradeoff when going for eventual consistency. We consciously decided to choose Patron as our main aggregate, because this is the Patron that has the majority of critical business rules. If the Patron aggregate is immediately consistent, any temporal inconsistency in Book aggregate can just be accepted with all its drawbacks.
I hope it makes it a bit clearer to you!
Cheers!
from library.
So StoreAndForwardDomainEventPublisher is implementation of events Sourcing pattern?
from library.
It is rather a transactional outbox
from library.
Related Issues (20)
- Domain description adding Polish translation
- Read only link to Miro board in readme HOT 1
- Not all tests are deterministic HOT 2
- Test MeteredDomainEventPublisherSpec is not running during build. HOT 3
- GroovyTemplateAutoConfiguration - Cannot find template. HOT 2
- Architecture hexagonal ? HOT 3
- Remove findBy from save at BookRepository.save(Book book)
- Why are there 3 same events ? Is this a mistake ? HOT 1
- Is the picture wrong ? HOT 2
- Patron definition HOT 1
- [Question] hold_database_entity and overdue_checkout_database_entity table not used? HOT 2
- [Question] What factors affected your design decision? HOT 1
- Is the storage of the Book attributes redundant? HOT 1
- Wrong domain abstractions HOT 1
- Food for thoughts about extensions HOT 1
- Question about aggregates
- MY PROJECT
- Hack, placeholder or mistake?
- Update to spring boot 2.7.5 and Java 17
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 library.