Using the DistributedCommandBus with JGroups

274 views
Skip to first unread message

James Vickers

unread,
Jul 27, 2016, 1:30:20 PM7/27/16
to Axon Framework Users

Hi all,

 

I have been trying to follow section 3.6 of the Axon user guide, “Distributing the Command Bus”, but to no avail.  I am using the Spring Framework and thus the JGroupsConnectorFactoryBean.  The JGroupsConnector never finds other members of the cluster; it prints that it is connecting to the cluster, but then each individual machine running the software seems to makes a cluster of one with itself and commands are not distributed.  I’ve tried several XML files to configure JGroups to find each other, but no luck there.  I have used the McastReceiverTest and McastSenderTest provided by JGroups to verify that my networking between machines using IP multicast is functional. 

 

Does anyone have a working example of a configuration for the DistributedCommandBus with the JGroupsConnector they can share, including the XML file for JGroups configuration?

 

Thank you,
James

Allard Buijze

unread,
Jul 27, 2016, 3:11:04 PM7/27/16
to Axon Framework Users
Hi James,

JGroups is easy when it works. Until then, it's another story.
There is a sample in the Axon sources: https://github.com/AxonFramework/AxonFramework/blob/master/quickstart/src/main/java/org/axonframework/quickstart/RunDistributedCommandBusWithSpring.java

The xml file used is here:
https://github.com/AxonFramework/AxonFramework/blob/master/quickstart/src/main/resources/tcp_gossip.xml

Note that IPv6 doesn't always work. Setting the system property: java.net.preferIPv4Stack=true at startup helped for me.

Hope this helps.
Cheers,

Allard
--
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.
For more options, visit https://groups.google.com/d/optout.

James Vickers

unread,
Jul 27, 2016, 5:32:56 PM7/27/16
to Axon Framework Users
How should one configure the IP addresses?  In particular:

bind_addr="${jgroups.bind_addr:127.0.0.1}"
bind_port="${jgroups.bind_port:7800}"

<TCPGOSSIP initial_hosts="127.0.0.1[12001]" timeout="1500"/>

Do these configuration values vary across machines?

Alexey Pakseykin

unread,
Jul 28, 2016, 7:40:00 AM7/28/16
to Axon Framework Users
James,

It reminds my difficulties with configuration.

I outlined some messy but working examples (progressively extended from quickstart by copying-and-pasting):
More specifically, this checkpoint (it demos both distributed Event and Command bus):
https://github.com/uvsmtid/incubator/tree/dce4dd1142d97513307c46a24c374cb4ada8845f/code_samples/axon-examples/axon-distributed-spring-extended
I tried to leave detailed readme how to set up the environment. If you don't want to setup RabbitMQ for distributed Events, I guess the commands sent over JGroups should still be seen in the output on two opposite JVMs (until hitting failure at missing RabbitMQ).

Michiel Rook

unread,
Aug 23, 2016, 4:13:52 PM8/23/16
to Axon Framework Users
Hi James,

I've recently published a small Axon + JGroups + Docker demo here: https://github.com/mrook/axon-jgroups-docker-demo

Note: this demo is based on the latest 3.0 milestone.

Regards,

Michiel
Reply all
Reply to author
Forward
0 new messages