Behavioral change in 4.9 JpaEventStoreAutoConfiguration
Basic information
- Axon Framework version: 4.9
Steps to reproduce
When upgrading our projects to 4.9 the autowiring of the JpaEventStorageEngine stopped working. We only use the framework, not Axon server. Apparently a new property "axon.axonserver.enabled" has been introduced that will disable autowiring of JPA and JDBC event storage engines. Unfortunately the default value is set to true, so for all projects where this property was not set (all of our services) the autowiring stops working.
Expected behaviour
Nothing should break when upgrading between minor versions. If there are breaking changes in minor versions, please make it clear in the release notes.
Actual behaviour
Broken builds...
Hi @magnusdurr, thanks for filing your concern with us.
Although the property is not new at all (we introduced it in Axon Framework 4.3, as you can see in this pull request, released in February 2020), I do agree we should've marked this shift within the release notes.
I assume your application excluded the axon-server-connector module, right?
The predicament that excluding the dependency wouldn't work did cross my mind when working on this pull request, which ensures JPA and JDBC are not wired whenever Axon Server is used. Especially the automagical construction of the Event Store-specific JPA entities caused issues in user's pipelines.
I, however, wrongfully assumed (1) that people using Spring Boot would be aware of the property and (2) I forgot to mark this switch in the release of 4.8.3. So, my sincere apologies for the issues this caused in your builds, @magnusdurr. This wasn't intentional at all.
This brings us to a tough position, though. Although excluding the dependency was the suggested approach to disable Axon Server pre AF4.3, this was never documented anywhere other than on our forum (as far as I am aware). Furthermore, Spring Boot's auto wiring annotations are (again, as far as I know) incapable of validating in one fell swoop whether a dependency is present, a property is present, and if the property is there, whether it is set.
We have worked on making custom @Conditional annotations in the past, so perhaps there's a mix to be built.
But, I do believe the workaround, which is setting a property (FYI, documented here), is pretty straightforward.
I hope my decision-making with PR #2871 makes sense, @magnusdurr. Still, you definitely have a point that we should've made this clear. As such, I have adjusted the 4.8.3 release notes to explain this potential breaking change, as you can see here.
Lastly, if you feel strongly Axon Framework should support a mix of module exclusion and Spring Boot property usage, do let us know.
Hi @smcvb,
It would be nice if excluding the axon-server module would do the trick, but if it is not an easy fix we will adapt and add the axon.axonserver.enabled property to our services. I get it that it is hard to keep track of all side-effects when making changes, especially in a complex spring autowiring scenario.
Thanks
Thanks for the understanding, @magnusdurr. And, as started off, we are very happy with this kind of communication. It helps us improve the things we lost sight off, which should improve the experience for everybody!
@magnusdurr, @abuijze did some additional digging while working on the AF's auto-configuration and found some ordering issues. It's this issue that led me to believe the property was the only way.
Pull request #2909 actually reverts the behavioral change you noticed by adjusting that ordering again.
So...I am going to extend my apologies again! Apparently my assumptions where wrong and we can keep both the property-based disabling of Axon Server and through exclusion of the axon-server-connector module.
The fix is slated for 4.9.1, by the way. Again, sorry for any inconvenience caused to you and the team (and to others who may encounter this issue and read it).
I've marked this issue as resolved by #2909 and adjusted the milestone to point to 4.9.1.