Hi Filip,
you probably don’t have to. When not using a Distributed Command Bus, you effectively handle commands on the node where they are also dispatched. If your level of concurrency is low, you’re unlikely to be handling commands for the same Aggregate simultaneously on different nodes. However, if you do, Axon will detect this when attempting to append events (or if you use GenericJpaRepository, make sure you have optimistic locking configured on your JPA entities). In this case one of attempts to save an Aggregate will result in a org.axonframework.commandhandling.model.ConcurrencyException, and force the transaction to roll back.
You can use a RetryScheduler on the CommandGateway to automatically retry commands that failed this way.
So you don’t need to use a DistributedCommandBus, but it does allow you to prevent these ConcurrencyExceptions, making your application more efficient when running in a highly concurrent environment.
Hope this helps.
Cheers,
Allard