Change a node's Instance Name when connecting to Axon Server

I’m currently putting together integration tests for a Spring Boot / Axon application.

In one of these test, it (a node) creates another node via SpringApplicationBuilder (under a different profile), connecting to the same Axon Server instance as its creator.

The problem I’m having is that event handling starts to behave weirdly, I believe that any ‘common’ event handlers on the original application with the second created node get ignored/lost.

Everything seems to behave normally when the instances are started outside of the test environment.

My thought is that in the test, the two nodes end up sharing an Instance Name on Axon Server (as they share a processId and hostname), which messes with handler registration/tracking. Does this make sense?

Is there a way that I can manually set this value for nodes connecting to Axon Server so that this doesn’t occur during testing?

I noticed this question was also posted on StackOverflow. Please see response there: