DistributedCommandBus and sendAndWait

Hi,

we are using DistributedCommandBus with JGroups and when using sendAndWait in subscribing processors the processors never receive response so they hang until timeout has
expired (we are using axon 3.2.1 with spring boot 1.5.13). When switching to SimpleCommandBus or when using regular send method everything works as expected. I’ve tried different configurations for jgroups (tcp, udp, different configurations of thread pools etc), made a simple project with latest version of axon but behaviour seems to be the same. When tracing is enabled for jgroups in the log i see that message is sent but not received (message only seems to be received when handler has exited), other than that no errors are found in logs.

Is this regular behaviour? Do we need additional configurations for DistributedCommandBus to work in this scenario (currently we are just declaring DistributedCommandBus bean and using axon-spring-boot-starter-jgroups and except for this everything else works as expected)?

Hi!

When setting up a DistributedCommandBus using JGroups this way, there are a few spring properties that you would usually set; the below is a minimum that we would use to run a quick local test:

axon.distributed.enabled=true #1
axon.distributed.jgroups.gossip.auto-start=true #2
axon.distributed.jgroups.bind-addr=127.0.0.1 #3

#1 enables the DistributedCommandBus. #2 starts a local Gossip server is non has been started yet. #3 forces JGroups to listen to localhost instead of binding to the public IP.

Some more detailed info on the JGroups DistributedCommandBus can be found in the manual (which refers to the general JGroups user guide), and you might want to check out what the autoconfigure actually does under the hood.

Many people have found setting up a JGroups DistributedCommandBus to be complex, especially when the network on which you have to do it is non trivial (running in a public cloud, running on top of Kubernetes etc.). This was one of the reasons for AxonIQ to create AxonHub, which provides a much easier way to distribute not only command, but also events and queries. You might want to check it out (there’s a free dev edition) and evaluate it as an alternative to the JGroups option.

Kind regards,