AxonFramework / AxonFramework

Framework for Evolutionary Message-Driven Microservices on the JVM
https://axoniq.io/
Apache License 2.0
3.32k stars 790 forks source link

Rethink use and intent of `AggregateFactory` #3093

Open smcvb opened 2 months ago

smcvb commented 2 months ago

When using an event-sourced aggregate, the framework uses the so-called AggregateFactory to construct an Aggregate instance. However, it is only used when there are events present for the aggregate. Thus, it is not used for making the initial instance.

The fact that it's called the AggregateFactory but isn't used in all scenarios makes it an oddball that causes uncertainty with users. Either making it the central point for Aggregate creation or replacing it entirely are things to consider.

The chance is high that the predicament around the AggregateFactory will automatically be dealt with in #3070. Furthermore, pull request #3052 already dropped the use of the AggregateFactory entirely.

Lastly, when working on this ticket, be sure to check if there are pending TODOs referring to the issue number of this issue.