Hello, i have a little problem in my current application.
I have an event that cannot be associated by any mean with anything within a bounded context, however when this event occurs i want to send out to every aggregate some command.
`
DownstreamEvent(id:DownstreamId)
AggregateCreatedEvent(id:AggregateId)
ReceiveDownstream(id:AggregateId, downstream:DownstreamId)
//When downstream event occurs, every aggregate should receive command ‘ReceiveDownstream’
//To put it simple, when it occurs for (aggregate allAggregates) gateway.send(ReceiveDownstream(aggregate, downstream)
`
Problem with above is that it is not persisted, wel it could be persisted in memory if i ensure that the events are always replayed from the beginning, but that would be a waste of memory i guess.
Another approach is with write side that would basically save every aggregateid and downstream id that were introduced in a system in mongo, but having write side just for this seems like a waste too.
Third option is to use sagas with ‘always accept property resolver’, i would need two sagas:
One that would handle down streams events that happened before aggregate was created, so every succeeding creation will receive an event
Second saga to handle down stream events that were received after fund was created, meaning saga starts when aggregate is created and then receives command on succeeding down stream events.
Sagas do persisting for me automatically (Mongo extension), so i do not need to replay the events, every saga will be associated with one id either the aggregate id or the downstream id,
the problem here is that i need to introduce ‘ayways true’ property, for the downstream/aggregate created event, so i’m always accepting it.
My question is, is that a good approach and if someone else could show me a way where i could do some ‘bulk’ command dispatching
Many thanks