Axon distributed command bus using spring cloud and eureka

I wanted to use distributed command bus in my axon based application, Is there any guidance around when to use distributed command bus. For my applications I have use cases where I have to interact with multiple microservices and currently all these interactions are happening via events. Can I directly use distributed command bus in such cases and if that is the case is this not incorrect to bypass the aggregate for the microservice which would be publishing such commands using distributed command bus.
I am planning to use the open source version of distributed command bus using eureka and spring cloud

Hi Ashwini,

Commands and events are both messages we can use (next to the queries, which we’ll ignore for now), each with their own purpose:

  • Command - An expression of intent to trigger an action in the domain.
  • Event - A notification that something relevant has happened inside the domain.

As such, it is totally valid to use both, as long as we are using them for the right purpose, as described in the definitions I’ve mentioned above.
For example, if you want to trigger some action in another microservice, a command would be the most appropriate message to use. However, if you simply want to notify another microservice that something has happened, after which they can decide what to do with that, an event would be more suitable.

As for which distributed command bus to use, there are actually two flavours. One is the DistributedCommandBus you mentioned, the other is the AxonServerCommandBus, with the former requiring additional configuration and the latter being zero-config. Some further detail on these can be found in the reference guide: https://docs.axoniq.io/reference-guide/axon-framework/axon-framework-commands/infrastructure#the-command-bus-distributed

Thank you Christian for clarifying