In the webinar for 3.2 it was mentioned, that a feature of 3.1 was the support of commandHandler factory methods. I couldn’t find an example and was not able to get it work.
I assumed I would do something like
@Aggregate
class AccountAggregate() {
companion object : KLogging() {
@CommandHandler
fun create(c: Command.CreateAccount): AccountAggregate {
apply(Event.AccountCreated(c.id))
return AccountAggregate()
}
}
@AggregateIdentifier
lateinit var id: String
var balance: Int = 0
@EventSourcingHandler
fun on(e: Event.AccountCreated) {
id = e.id
balance = e.balance
}
}
but I get No handler was subscribed to command [org.springbootcamp.axon.querybus.Command$CreateAccount]
What did I get wrong?