Giter Site home page Giter Site logo

Comments (6)

asm89 avatar asm89 commented on July 4, 2024

You're aggregate root has a certain state (derived from the history of events if you're doing event sourcing). Based on the state the method call on the AR will either fail or succeed?

If you're using the DBAL event store, it will throw an exception if the same playhead gets inserted twice (for one id), that probably covers your "problem"? :)

from broadway.

macintoshplus avatar macintoshplus commented on July 4, 2024

Let me explain:

In the Model Reading I keep the version of the aggregat linked to the last event.

User 1 : creates a aggregat (version 0).

User 1 and 2 : load the view for the aggregat (version 0).

User 2 : change the aggregat by a command indicating that the aggregat must be version 0. (change version from 0 to version 1)

User 1 : changes aggregat by a command indicating that the aggregat must be version 0. Changes can not be made because it is based on data been deprecated.

I do not know if I express myself well. It is to avoid this "problem" I ask this question;-)

So what's the best solution?

from broadway.

asm89 avatar asm89 commented on July 4, 2024

I'd have to think about a "nice" way of doing this, but I'm wondering if you really need this? Do you have an example of your actual domain? What are the chances of this happening? What would the cost of such an error be?

As said before, if two processes are committing at the same time, only one of them will be able to save the events as of this moment.

from broadway.

macintoshplus avatar macintoshplus commented on July 4, 2024

I have an application where the risk of competition between two users is very high.

Another solution would be to check the event happened between the two versions (current and those notified in the order) to block similar commands.

Otherwise, the last command to the last word!

The concurrency is very difficult to manage.

If a command overwrites the previous amendment, I must provide a means to reapply the changes overwritten.

from broadway.

aaronmu avatar aaronmu commented on July 4, 2024

👎

I think you need to deal with this yourself. Perhaps some sort of process manager that detects concurrent events and initiates merging? Perhaps you need a different model? I'm just thinking out loud here.

from broadway.

macintoshplus avatar macintoshplus commented on July 4, 2024

It's true. Thank for your help !

from broadway.

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.