Distributed Command Bus


We are planning to use Distributed Command Bus in our implementation as we need to distribute our microservices, command handlers and event handlers across different VMs. The issue that we are facing is, the deployment of these components on Cloud Foundry (as PaaS) in AWS. Cloud Foundry, per design, opens only one incoming port which is HTTP port for incoming request.

In case of microservices in CQRS Axon Framework, we would need 2 ports - one incoming HTTP request (which is not a problem) and another jgroups port to join the cluster and fire commands. The second port is a problem in Cloud Foundry environment because of the reason mentioned above.

Any hint to overcome this issue would be helpful. Do let me know if you need any further information on this.

Second problem is about command handlers. Though command handlers needs only one port and i can use the one opened by CF for incoming requests, the issue is with the IP address (jgroups bind address). The IP address of container in which command handlers are deployed are not exposed outside the host machine. Because of this, the command handlers are unable to participate in jgroups cluster.

We are kind of stuck with this scenrio.


Hi Ritesh,

sounds lije Jgroups and CloudFoundry won’t be friends anytime soon.
One solution I could think of is to inplement a custom connector that sends commands over http. Discovery of nodes could be hardcoded, or perhaps using a service registry (Consul, or anything that CloudFoundry provides). Thus connectir could also be registered as a servlet, in order to receive commands from other nodes.



Sorry for the typos. Sending this from my phone…

Hi Allard,

Will this no longer be an issue with Axon 3.0 and use of Spring cloud connector ? i.e. assuming it would use some discovery service to discover the nodes.
Please confirm


That’s correct. In Axon 3.0.4, you can use Spring Cloud Discovery and the Spring HTTP Client to route commands between nodes.