Class MultiClusterProperties

java.lang.Object
org.openspaces.core.multicluster.MultiClusterProperties

public final class MultiClusterProperties extends Object
Reads routing configuration from a flat property map, so every mode can change without recompiling - which is the difference between "we need a release to move traffic" and "we edit a file".

The file carries policy, not connections. Cluster proxies are built by the application and passed in, so the per-cluster keys here are topology metadata only - site, locality, read weight. There is deliberately no way to put lookup locators or credentials in this file: the application owns connecting to its spaces.

Map<String, GigaSpace> proxies = Map.of("us-east", east, "us-west", west);
MultiClusterGigaSpace gigaSpace =
        MultiClusterProperties.configurerFrom(props, proxies).gigaSpace();

Format

multicluster.name                        = orders                    # optional, used for JMX and logs
multicluster.clusters                    = us-east, us-west          # order matters: it is the default priority
multicluster.cluster.us-east.site        = us-east-1                 # optional
multicluster.cluster.us-east.local       = true                      # optional topology metadata
multicluster.cluster.us-east.weight      = 3                         # optional, for weighted balancing
multicluster.activeCluster               = us-east
multicluster.readActiveCluster           = us-west                   # optional: READ_ACTIVE reads go here
multicluster.priority                    = us-east, us-west
multicluster.writeMode                   = WRITE_SYNC
multicluster.readMode                    = READ_ROUND_ROBIN
multicluster.failoverPolicy              = AUTO_FAILOVER_NEXT_AVAILABLE
multicluster.transactionPolicy           = ACTIVE_ONLY_WHEN_TRANSACTIONAL
multicluster.quiescePolicy               = RETRY_UNTIL_ACTIVE
multicluster.failureThreshold            = 3
multicluster.failureWindow               = 30s
multicluster.requiredSuccessCount        = 0
multicluster.takeFanOutOnMiss            = false
multicluster.asyncQueueCapacity          = 10000
multicluster.fanOutTasks                 = false
multicluster.clearSumsAcrossClusters     = true
multicluster.jmx                         = true

Unknown keys are an error

A misspelled key that is quietly ignored is the worst kind of configuration bug: the file says readMode=READ_ROUND_ROBIN and production serves every read from one cluster. Every key is validated and anything unrecognised is rejected by name.

Durations accept 30s, 500ms, 5m, or an ISO-8601 form like PT30S.

  • Method Details

    • configurerFrom

      public static MultiClusterGigaSpaceConfigurer configurerFrom(Properties properties, Map<String, ? extends GigaSpace> spaceProxies)
      Builds a configurer from properties, wiring in the cluster proxies the application built.

      multicluster.clusters lists the cluster names, and every listed name must have a proxy in spaceProxies - a name in the file with no proxy behind it is a configuration error, not something to skip silently.

      Throws:
      IllegalArgumentException - if a key is unrecognised, or a listed cluster has no proxy
    • configurerFrom

      public static MultiClusterGigaSpaceConfigurer configurerFrom(Map<String,String> properties, Map<String, ? extends GigaSpace> spaceProxies)
      Builds a configurer from a plain map - e.g. Spring's Environment or a YAML binder - wiring in the cluster proxies the application built.
      See Also:
    • configFrom

      public static MultiClusterConfig configFrom(Properties properties)
      Reads the routing configuration only - no topology.

      For the common Spring case of wiring clusters as beans while keeping the modes in a file: configurer.cluster(...).config(MultiClusterProperties.configFrom(props)).

    • configFrom

      public static MultiClusterConfig configFrom(Map<String,String> properties)
      Reads the routing configuration only - no topology.
      See Also:
    • descriptorFor

      public static ClusterDescriptor descriptorFor(Map<String,String> properties, String cluster)
      The topology metadata declared for one cluster: site, locality and read weight, defaulted when the file says nothing about them.