So what is documented here can’t help in my case, right?
So is there a way to simply catch these Exceptions and repeat my command?
Any better Ideas? I don’t like to use a distributed command bus with routing to specific nodes for certain aggregates…
Alternatively you could also opt for a distributed command bus. See the same link. That should ensure all commands are dealt with on the same instance and use the locking by the command gateway to ensure sequential handling of them. This may be a bit more complex than necessary for your use case though.
Be aware that with retry the last command wins and potentially overwrites the state of a previous command execution. Just make sure this is what you want
The above configuration turned out to be correct, but I was using the commandBus in my JUnit Testcase.
I had to explicitely use the commandGateway for the retry-mechanism to work.
The thrown RepositoryException was a subclass of AxonNonTransient Exception. That had the effect, that the RetryScheduler didn’t retried at all!
And that sounds strange to me. I will open another thread for this. My workaround was to subclass IntervalRetryScheduler and implement an “always transient” return:
any exception extending AxonNonTransientException should not be retried, because a retry will cause the same exception to happen again (hence non-transient).
Which exact exception is your command throwing?
Note that ConcurrencyException extends AxonTransientException (explicitly indication a retry makes sense).