EventFlow
EventFlow copied to clipboard
IEventUpgrader usage differs for aggregate loading and read model repopulation
Let's take a sneak peak at the docs, namely at the page explaining the process of event upgrading: https://eventflow.readthedocs.io/EventUpgrade.html. The relevant excerpt reads as follows:
A new instance of an event upgrader is created each time an aggregate is loaded. This enables you to store information from previous events on the upgrader instance to be used later, e.g. to determine an action to take on a event or to provide additional information for a new event.
Whilst the first part of this statement is completely correct, and new instance is, in fact, created for an aggregate loading process in its entirety, the latter part — the one establishing one's ability to store information from previous events on upgrader instance — is partially incorrect.
EventUpgradeManager
is resolving new instance of corresponding upgraders for every batch of events it's asked to update. When aggregate is being loaded, this batch would consist of all the corresponding events, all right.
But when read models are being populated, no such mechanism exist — events belonging to one aggregate can (and, in fact, inevitably will, when aggregates are long-living and changing for a long period of time) be upgraded using two separate instances of upgrader.
Ergo, docs are, as of now, misleading.
The proposed solution is either to clarify this finer point in docs, or possibly change read model population mechanism so that this invariant still holds — @rasmus, what do you think? I may be able to draft up a PR later this week, if you're interested.
Hi @radiosterne this is clearly bug, as stated it yourself, its unexpected behavior. At work we don't use that part of EventFlow as we typically have read models in separate micro services.
@radiosterne Did you happen to draft a PR for this? We would really appreciate your help on this issue.
Hello there!
We hope you are doing well. We noticed that this issue has not seen any activity in the past 90 days. We consider this issue to be stale and will be closing it within the next seven days.
If you still require assistance with this issue, please feel free to reopen it or create a new issue.
Thank you for your understanding and cooperation.
Best regards, EventFlow
Hello there!
This issue has been closed due to inactivity for seven days. If you believe this issue still needs attention, please feel free to open a new issue or comment on this one to request its reopening.
Thank you for your contribution to this repository.
Best regards, EventFlow