ConsistentHash with SpringCloudCommandBus

Hi!

I have tried to use my AxonFramework application in distributed mode using SpringCloudCommandBus and Eureka Server, but that’s not worked as expected. Commands to aggregates with same identifier are not routed to one node.
Debugging shows that all nodes have same version of ConsistentHash with command filter for all commands.
Hashes for each member generates using its name and segment index. For local member name always same on each node, so computed hashToMember map on each node different. Maybe that’s the cause of incorrect routing?

Hi Aleksey,

That’s troublesome to hear and not the experience I’m having at a client right now.
Did you specify a RoutingStrategy in your application at all? This shouldn’t be necessary in a Spring environment though, as Axon will provide a sensible default, but asking this for verification.

The RoutingStrategy, which defaults to the AnnotationRoutingStrategy based on the @TargetAggregateIdentifier field in your commands.

You point out that ‘Debugging shows that all nodes have same version of ConsistentHash with command filter for all commands.’.

Does this mean that in for example a 2 node set up, both nodes have an identical ConsistentHash?

This on it’s own isn’t faulty, as both nodes should end up with the same ConsistentHash as soon as both applications are started up (and no dynamic removal/addition of command handlers is taking place).

If the ConsistentHash however only shows the local node and no others, then there definitely is something wrong.

Could you provide a more thorough description of what the ConsistentHashes contain?

Based on that I think we can figure out what’s happening.

Cheers,
Steven

Hi, Steven!

I’m using autoconfigured routing strategy (AnnotationRoutingStrategy), all commands have TargetAggregateIdentifier annotated field.
I mean on all nodes ConsistentHash have knowledge about local member and other members. Sample toString description: ConsistentHash [MY-SERVICELOCAL,MY-SERVICEhttp://10.252.30.53:8090,MY-SERVICEhttp://10.252.30.53:8091]

All instance of application started up. ConsistentHashChangeListener shows that there is no change of ConsistentHash version happends on heartbeat event.

CommandFilter for each member in ConsistentHash has every command for my aggregate.

Hi Aleksey,

I’ve been digging a little, but you’re right.

The fact the local member defaults to serviceId.toUpperCase() + [LOCAL] will ensure an inconsistent routing solution when using the SpringCloudCommandRouter.

I’ll look for a solution ASAP. Stay tuned!

You may assume a fix will be in for release 3.2.2 by the way.

Thanks for pointing this out Aleksey!

Cheers,
Steven

Thank you, Steven!

Hi Aleksey,

You can trick this issue if you want for the progress in resolving the incorrect behavior you’ve uncovered.

Cheers,

Steven

Hi, Steven!

Thanks for fix in such a short time.

Hi Aleksey,

Ah I take it you saw this release then, great!
And no worries, that issue did require an immediate fix.

If you encounter any other issues feel free to drop them here or on the GitHub page!

Cheers,
Steven