I’m not even quite sure that I need event sourcing in my situation (I also looked at Sheduler-Agent-Supervisor here), but now I’m wondering if my usage of projections is acceptable.
So, I’ve got Trips, Groups, Users, and Places in my system. Each trip has a route of Places and belongs to some groups. The trip is created or updated rarely, queries like ‘give me all Trips for some Place|Group filter by Trip parameters order by Trip date’ are very frequent. That’s why I’m going to keep Places and Groups in a document database and keep a list of Trips (only tripID and filterable parameters) for each Place|Group.
Now about projections. There will be a stream for each Trip. And a projection for each stream from category ‘trip’. The projection will keep track of current state of the Trip, at least most important parameters and list of linked Place and Group ID’s. When new Place is added to Trip, an event is emitted by this projection to ‘places’ stream containing current parameters of the Trip. When some parameter changes the event is linked to streams of all interested Places|Groups (the list of interested Places|Groups is contained in projections state). When a Place is removed from Trip, the event is linked to that Place’s streem. Then separate services subscribe to streams of places|groups and update their read models (in MongoDB).
The question is how expensive is it to keep million(s) of projections, where each projection holds (partially) the current state of the aggregate and can emit dozens of events upon each received event (which though happens not often)?