Happy to see you’ve already found some information on your own to tackle the issue!
I’ll try to resolve the remaining two questions you’ve asked right now.
On top of that, I want to be very specific that this mailing list will be discontinued as of the 28th of September (2020).
Instead of that AxonIQ has provided https://discuss.axoniq.io/, to support a more forum based solution of discussing things.
Trust to see you there in the future!
Now, for you questions:
1.) Will this workaround create some unforeseen issue for me?
The @RoutingKey is only a necessity if the RoutingStrategy used by the distributed CommandBus (for example Axon Server) is configured to be the AnnotationRoutingStrategy.
This AnnotationRoutingStrategy is the default for the AxonServerCommandBus, so it does make sense you’ve uncovered this solution of using an @RoutingKey in your fields.
Note that the @TargetAggregateIdentifier annotation (required to route commands consistently to the same instance, and to define which aggregate they’re targeted at) is meta-annotated with @RoutingKey.
As such, you would only be required to use the @RoutingKey in the following scenarios if the AnnotationRoutingStrategy is used:
- If the command is not targeted towards an Aggregate.
- If the command creates the Aggregate
Whether you are hitting situation 1 or 2 in your example isn’t entirely clear to me, but in neither scenario would I regard the usage of the @RoutingKey as a workaround.
There is a routing requirement that commands are consistently routed to the same instance and the same command model component.
If you want the service to be in charge of routing, you would adjust the RoutingStrategy.
If you feel your commands require this information, than I would recommend using the @RoutingKey.
Again, neither is wrong. It’s a matter of choice really.
2.) Axon is open source right? Do you want community support for expanding / updating your documentation? There’s nothing in the framework documentation that I could see that ever mentions RoutingKey. I stumbled on it from exception analysis and looking at the api docs.
Axon Framework, the extensions and the Reference Guide are all open source indeed.
Any contributions are always very much appreciated!
So if you are up for the task, I’d be happy to review your contributions as soon as you’ve sent them in.
Trusting this will help you further Philip!
Steven van Beelen
Axon Framework Lead Developer
Want to learn more about DDD, ES, CQRS and more?
Join our Event-Driven Virtual Conference 2020. Buy your tickets here.