Comments (7)
After a chat - the way I was thinking about splitting was wrong.
We'd not be splitting on the event's Versioned
namespace - we'd be splitting based on the Handler
namespace.
And a rule would be to not change other handler's models (good practice in any case)
A model would be a self-contained unit inside a handler - and a projection would encompass all the events the 1 handler handles.
We can add a special Handler.Rebuilding
hook method to allow the user to delete all the models they've built before starting the rebuild
from aggregates.net.
Thinking about this issue - while it was a good idea at the time there is a big issue.
Given an endpoint that has 10 different event namespaces and maintains read models in a single database. If we update one event and replay only that namespace - how would we know which objects in the database to rebuild. The endpoint would receive all the events over again pertaining to "Customers" but since its already processed those events it would be overwriting the customers it already created.
It may be a better feature to support updating projections when a new event is added or upgraded.
from aggregates.net.
- At the moment the total"projection" is implied based on all the eventhandlers available in the endpoint. If there is a new event added then the whole endpoint is automatically replayed when the version number is bumped as the new event registration changes the subscription in ES.
What I would like is to have greater control on each projection within the endpoint. So group the event subscriptions by event handler class and register at event store multiple subscriptions I guess.
Then use subscription version number based on a decorator on each handler instead of the assembly version number.
The challenge is whether ES let's an endpoint essentially listen/own multiple projections explicitly I guess.
Galen
from aggregates.net.
@galenp breaking up the projection into many pieces is pretty easy to do - but while I was working on it I thought about what would happen if - say a new event was added and only the "Customer" projection was replayed.
Basically because the endpoint -> database is meant to be a 1-1 relationship, the now-updated endpoint would get all the "customer" events over again. Only they've already seen all those events and the database has all those models. There would be no way to "delete" all the customer read models for the rebuild ahead of time.
from aggregates.net.
I was thinking it would be better to just update the projection when starting - and leave it to the user to increment their endpoint's version if they want to replay everything
from aggregates.net.
So the endpoint has 3 projections:
CustomerDetails
CustomerOrders
OrderDetails
You add a new event and it's used in 2 of 3 projections.
This triggers a rebuild in 2 of 3 projections.
It would be nice to have a hook here before the rebuild to delete the existing readmodel before the rebuild occurs.
Some/most readmodels shouldn't require a delete as a replay over the top should yield the same result as a replay on a blank db. The hook option would be nice tho and suit cases where the projection reads the existing data. Something I try to avoid doing.
I think you can have it so it replays only at the start of the endpoint. Or maybe have if so we can update the version by sending a system message and triggering a replay when that occurrs.
from aggregates.net.
Upon startup the endpoint would map out which events are handled by which handlers and create a single projection which links events to one of multiple handlers like so
'CustomerCreated': function(event, state) {
linkTo('CustomerDetailsHandler.0.1');
linkTo('CustomerAnalyticsHandler.0.1');
}
Specific details on versioning the handler streams and the projection itself will need to be thought about more deeply
from aggregates.net.
Related Issues (20)
- Migrate to Actions
- Any plan to write a comprehensive documentation HOT 1
- Adding EventStore to my endpoint fails HOT 7
- ProjectionsManager is failing because there's no SSL certificate available. HOT 6
- Isn't there a way to NOT use EventStore? HOT 3
- Error when calling Apply method in the Domain app HOT 6
- How to catch BusinessException in custom built behavior? HOT 14
- Writing to EventStore is taking so much time, sometimes it doesn't work, and events don't reach directly to Application endpoint. HOT 8
- Taking snapshot to speed reading from EventStore HOT 3
- Inheritance in models HOT 1
- Replay all events if application endpoint version upgraded HOT 2
- Sagas Doesn't Work HOT 16
- Setting Correlation Id Can Make NSB Throw HOT 1
- Migrate logging to Microsoft.Extensions.Logging.Abstractions HOT 1
- Add development mode option
- Force Microsoft DI and Logging Infrastructure HOT 2
- Use correct mime type for message content type
- ScopeValidation of DI when in Production Mode HOT 10
- IApplicationUnitOfWork not present in TestableContext HOT 3
- Testing - Child Entity - Multipe Events HOT 3
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 aggregates.net.