You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Correct me if I'm wrong but let's say I need to implement a Query that read events from 2 different aggregates, from the documentation the simplest Query example looks like this:
structSimpleLoggingQuery{}#[async_trait]implQuery<BankAccount>forSimpleLoggingQuery{asyncfndispatch(&self,aggregate_id:&str,events:&[EventEnvelope<BankAccount>]){for event in events {println!("{}-{}\n{:#?}", aggregate_id, event.sequence,&event.payload);}}}
On this example (and others looks similar) I have to provide one aggregate type only, hence I can't handle events from other one.
One option is to create an enum with all aggregates the query is interested in + implement From trait like this:
enumBankQueryInput{
case BankAccount(BankAccount),
case TaxesAggregate(TaxesAggregate),}implFrom<BankAccount>forBankQueryInput{
...
}
This way I could write a Query which is interested on bank account movements and tax events.
Let me know if this example has sense to you.
A single cqrs framework should be able to manage more than one aggregate.
Related with #90
The text was updated successfully, but these errors were encountered: