Giter Club home page Giter Club logo

Comments (4)

pilloPl avatar pilloPl commented on July 21, 2024

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.

bslota avatar bslota commented on July 21, 2024

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.

CamilYed avatar CamilYed commented on July 21, 2024

So StoreAndForwardDomainEventPublisher is implementation of events Sourcing pattern?

from library.

bslota avatar bslota commented on July 21, 2024

It is rather a transactional outbox

from library.

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.