Yes, that's definitely possible @Stephan.
Assuming you're in a Spring Boot environment, the only thing you have to do is set the right dependency for the type of DistributedCommandBus
you want (thus SpringCloud or JGroups) and set the axon.distributed.enabled
property to true
.
The framework will automatically search for all the @CommandHandler
annotated functions. If your application still states it cannot find 'a node to expect the command', then something fails during the wiring process.
Or simpler put, I can think of two reasons:
1) Your @CommandHandler
annotated functions aren't registered to the DistributedCommandBus
.
2) The message-handling information isn't shared between your nodes.
Any how, the simple answer to your question is: yes, you can have your @CommandHandler
annotated functions in different services.
Why it isn't working though, is something different.