Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider projections on separate threads #2

Open
MV10 opened this issue Oct 3, 2020 · 0 comments
Open

Consider projections on separate threads #2

MV10 opened this issue Oct 3, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@MV10
Copy link
Owner

MV10 commented Oct 3, 2020

Projections can run out-of-band.

One option is to run them serially, as they are now, but on a separate thread so that the post-event method returns more quickly.

Another option is to run them in parallel on multiple threads, but this would require providing separate copies of the domain model state to avoid read collisions across multiple threads. This may be too expensive for complex domain data models. In terms of implementation, the projection handlers would probably change to take a reference to a domain data object instead of using the shared property. It is possible to make method calls thread safe but it's unreasonable to expect a library consumer to make all the various properties of a domain model thread safe (with lock everywhere, for example).

It may be useful to make this a configurable policy per domain model.

@MV10 MV10 added the enhancement New feature or request label Oct 3, 2020
@MV10 MV10 changed the title Consider projections on background threads Consider projections on separate threads Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant