Axon & Spring Cloud discovery with zookeeper

Hi Everyone,

I’m setting up a sample project with Axon 3.1.3 and Spring Boot 1.5.x to understand how to replace a JGroups based distributed command bus with a Spring Cloud alternative.
Since we’re already using Zookeeper in our project I went for Spring Cloud Zookeeper.

So far I have a working sample with a SimpleCommandBus. When I replace that with the Spring Cloud distributed command bus I get error stating “No node could be found for given command”.

I can confirm all my nodes register in Zookeeper. With some ZK UI I could read all data stored in ZKPath /services//. In debig mode however I noticed the consistentHash inside SpringCloudCommandRouter is always empty.

Am I missing something or using incompatible versions?

My sample applications lives here:


Hi Benoit,

try using the SpringCloudHttpBackupCommandRouter instead. Not all discovery servers support dynamic meta data. In such case, the SpringCloudHttpBackupCommandRouter will fallback to invoking a URL on discovered services to ask for supported command types.

By the way, if you’re using the Spring Boot Autoconfiguration for Axon, just set axon.distributed.spring-cloud.fallback-to-http-get=true in to get the same effect.

Let me know if that works for you.


Hi Allard,

I got it to work with SpringCloudHttpBackupCommandRouter. Thanks for the tip.
What’s the added value of ‘dynamic metadata’? I don’t really understand yet…

Hi Benoit,

Spring Cloud set’s up something which is called a ServiceInstance for any service which is part of you set up.

The ServiceInstance has the notion of metadata, which when we created the SpringCloudCommandRouter for Axon seemed like the best approach to store command-handling knowledge of a given instance in.

However, like Allard points out, several implementations of Spring Cloud do not support that we try to adjust that metadata.

Known culprits of this are Consul, and now also Zookeeper.

Eureka deals just fine with us adding command-handling information to the metadata, which was what we used to test in the conception phase of this feature.

Hope this gives you some background.

And I am obviously happy to hear that using the back up resolved your problem!