Sending multiple successive commands fails

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)
}

Hi Gabriel,

That’s not what I would expect. In fact, I send commands in quick succession all the time.
From your comments, it seems like the connection is broken when sending a command. Maybe something causes the connection to fail. Do your logs display anything?

Thanks Allard. I suspected so. So far we have not discovered anything unusual but we will continue investigating. We’ll report here any findings.