Snapshotting 2 Aggregates having same identity
pirvudoru opened this issue · comments
Doru Pirvu commented
Not sure if this is the right place for the issue but, i have the following aggregates:
- MyApp.AModule.Aggregates.Foo
- MyApp.BModule.Aggregates.Bar
The identity is shared, so the same identity (say 52b439d4-cd86-4a09-a935-5c9227e1b1af) can correspond to Foo and also a Bar aggregate instance.
With snapshotting disabled, everything works well.
If i enable snapshotting on one aggregate, everything works well.
When I enable snapshotting for both of them, I receive errors like:
lib/myapp/bmodule/aggregates/bar.ex:13: MyApp.BModule.Aggregates.Bar.execute(%MyApp.AModule.Aggregates.Foo{}, %MyEvent{})
Somehow the snapshot is not stored per type + identity, but only for identity.
How can i enable snapshotting on both aggregate types without Commanded getting confused about which type of snapshot it needs to load?