{
"id"
:
"3EEEC9B0-D176-4F2C-A791-42C57191C1BE"
,
"adjustment"
:
"-2"
}
First thing I noticed is that you event is not idempotent
You should not create events with - or + values but the actual adjusted value
--
This all seems fine but seems incredibly wasteful for two reasons
- I have to load all events for the aggregate each time I process a single event (OK perhaps I snapshot every 50 events or so)
- If I encounter the same aggregate 5 events later, and then again 3 events after, I have to repeat step 1 above 3 times when I could have just done it once and applied 3 events
My question is this doesn't seem right to me, and the DBA will throw a hissy fit as I bash the SQL Server every 250 ms calling the same procedure. Ideally what I really want to do is the following
- Get all new events since I last processed them
- Group them into batches for each unique instance of an aggregate
- Apply all outstanding events in one go
- Call the stored procedure once with the adjusted inventory value
Is there a pattern for doing this specifically with EventStore? I was thinking perhaps a projection could create new streams per aggregate from the single events stream, and maybe I subscribe to them?
What I don't want to do is keep a list of all aggregates and poll them for changes and update the database if they exist, as this woudl mean checking every aggregate as I won't know which ones have new events. If I have 1000's of products event with threading that is gonna be SLOW!. Maybe I am being dumb but my fuzzy little head is gonna explode soon thinking about it, and I'm sure you don't want that on your conscience. ;-)
> email to dddcqrs+unsubscribe@googlegroups.com.
> Visit this group at https://groups.google.com/group/dddcqrs.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/dddcqrs.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+u...@googlegroups.com.