I’m not a huge fan of Axon with annotations and would like to write a new project without them. Ideally I would like to write it in Kotlin in Ktor rather than Spring Boot. Does anyone have any experiences, code samples, tips? I haven’t found much in Axon docs about using it without annotations.
PS: I’ve just noticed that at least some of Axon annotations are indendent of Spring. Has anyone tried using Axon without Spring and could share his thoughts/experiences?
We’re using Axon w/ Kotlin and WebFlux. I find the Axon and WebFlux annotations to be quite tasteful, and WebFlux has functional routing definitions (I think there are better docs but those came up first in Google).
The thing that drives me crazy is JPA/Hibernate and given some free time I would swap them out for a more Kotlin-y SQL adapter. We’ve had to basically pretend we’re writing Java, with empty constructors and lateinit, to make it halfway usable.
Thanks @Joel. I would like to avoid Hibernate as well, I’m not a fan of this tool at all to be honest
The thing is that I would like to avoid Spring entirely and go for another framework (currently assessing Ktor). The thing is though that without Axon’s plugin for Spring I get no autowiring and autocreation of Axon’s classes and I need to write stuff like:
CommandBus commandBus = new SimpleCommandBus();
// to subscribe a handler:
commandBus.subscribe(MyPayloadType.class.getName(), myCommandHandler);
The worst thing is that there is no info on how to do this in the current documentation and I need to go through the horribly outdated one: https://legacy-docs.axoniq.io/reference-guide/v/2.4/command-handling.html
Basically, just use the DefaultConfigurer class to get started. Axon will initialize all components using sensible defaults and allow you to customize the configuration as well. All code examples in the reference guide are available for Spring Boot as well as “plain configuration”.
I don’t know, if this could help you, but I made a showcase on how to configure axon for JavaEE or MicroProfile on Quarkus: showcase-quarkus-eventsourcing
It is in Java, not Kotlin.
It is just a small example, without saga e.g.
And it has an extra abstraction for „axon outside the boundary“, that may be more complex than necessary.
However, there is a class „AxonConfiguration“, that attaches everything to the config and provides the necessary services (commandgateway…)