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

116 views
Skip to first unread message

Patrick S

unread,
Sep 9, 2020, 10:06:09 AM9/9/20
to Axon Framework Users
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 (https://github.com/holunda-io/camunda-bpm-taskpool) 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,
Patrick

Steven van Beelen

unread,
Sep 16, 2020, 10:42:19 AM9/16/20
to Axon Framework Users
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!

Cheers,
Steven

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 https://discuss.axoniq.io/.
Hope to see you there!

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/axonframework/6869d0ef-e119-467e-8dcb-2c368b883970n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages