Configuration in SpringBoot

If you use Spring, you may want to consider using the JGroupsConnectorFactoryBean. It automatically connects the connector when the ApplicationContext is started, and does a proper disconnect when the ApplicationContext is shut down. Furthermore, it uses sensible defaults for a testing environment (but should not be considered production ready) and autowiring for the configuration.

If Spring Boot is used, the configuration can be further simplified by including the axon-jgroups-spring-boot-starter dependency.

The settings for the JGroups connector are all prefixed with axon.distributed.jgroups.

# enables Axon to construct the DistributedCommandBus
axon.distributed.enabled=true
# defines the load factor used for this segment. Defaults to 100
axon.distributed.load-factor=100

# the address to bind this instance to. By default, it attempts to find the Global IP address
axon.distributed.jgroups.bind-addr=GLOBAL
# the port to bind the local instance to
axon.distributed.jgroups.bind-port=7800

# the name of the JGroups Cluster to connect to
axon.distributed.jgroups.cluster-name=Axon

# the JGroups Configuration file to configure JGroups with
axon.distributed.jgroups.configuration-file=default_tcp_gossip.xml

# The IP and port of the Gossip Servers (comma separated) to connect to
axon.distributed.jgroups.gossip.hosts=localhost[12001]
# when true, will start an embedded Gossip Server on bound to the port of the first mentioned gossip host.
axon.distributed.jgroups.gossip.auto-start=false