We have discovered a problem with our use of the Axon library which we use for event sourcing in our Java/SpringBoot/Gradle backend services. It seems that we cannot dispatch 2 commands in a row as indicated in the pseudo code below. What do we do wrong? Or is this a known issue and if yes, how can it be addressed? We do not have any non-standard configuration and use the defaults. Here’s pseudo code how to reproduce it:
class ExampleApiDelegate(
private val commandGateway: CommandGateway,
private val queryGateway: QueryGateway
) {
fun queryAfterCommand() {
val id = "testId"
commandGateway.sendAndWait<String>(Command(id))
// fails because connection is closed
queryGateway.query(Query(id), String::class.java).get()
}
fun commandAfterCommand() {
val id = "testId"
commandGateway.sendAndWait<String>(Command(id))
// fails because connection is closed
commandGateway.sendAndWait<String>(Command(id))
}
private data class Command(var id: String)
private data class Query(var id: String)
}