Routing with distributed services and axon server - Routing key doesn't work

Hi together,

I’ve a problem with routing of commands when having Axonserver CE (Axon Version 4.3.1) and multiple services which contains the same command. So first my Szenario:

All of my services using a lib ( which are providing some basic commands, like e.g. “io.holunda.camunda.taskpool.api.task.CreateTaskCommand”. And of course also related Aggregates. Those Commands/Aggregates do not have some special RoutingKey.

My services are doing different stuff, so if a service fires the given command, it should also process this command. Problem is that axon server routes those commands (randomly) to all service which are using the (taskpool) lib.

So I already looked around here and found one possible solution … providing a custom RoutingStrategy. So my new custom strategy just appends the spring app name to the one from AbstractRoutingStrategy. And I’ve also verified that this really happens. But Axon Server does still route them to random services.

Is there something missing additional to the strategy? I think also the command handler needs some special key for this, or not? But I found no Information how I can do this.

Best Regards,

Hi Patrick,

I have a gut feel I know what is going on, so let me explain that to you.
The RoutingStrategy provides a key based on which the distributed CommandBus will route on.
In case of non-Axon Server, this would be the job of the CommandRouter (either JGroups or Spring Cloud).
When using Axon Server, it is in charge of deciding a route for the given key.

Deciding what this route is, is indeed random for the first entry of said key. After that, this is consistent.
Thus adding a routing key referencing the Spring application name will firstly choose one of your services, let’s call this service foo.
Every use of the same Spring application name should ensure that that command is also routed to service foo.

If the latter is also what you are seeing, is currently unclear to me.
If you could validate that on your end Patrick, that would be great.

Hoping this will help you further Patrick!


PS. It is important to note that this mailing list will be discontinued as specified in this thread.
Instead of this mailing list we have moved to use a forum style of communication, at

Hope to see you there!