Synchronization Endpoint

A MongoDB based implementation of the Space Synchronization Endpoint.

Library dependencies

The MongoDB SpaceClosed Where GigaSpaces data is stored. It is the logical cache that holds data objects in memory and might also hold them in layered in tiering. Data is hosted from multiple SoRs, consolidated as a unified data model. Synchronization Endpoint uses the MongoDB Driver For communicating with the MongoDB cluster. Include the following in your pom.xml

    <!-- currently the MongoDB library is not the central maven repository --> 
    <repositories>
        <repository>
            <id>org.openspaces</id>
            <name>OpenSpaces</name>
            <url>http://maven-repository.openspaces.org</url>
        </repository>
    </repositories>


    <dependencies>
        ...
        <!-- mongodb java driver -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.2.0</version>
        </dependency>

        <dependency> 
            <groupId>org.antlr</groupId> 
            <artifactId>antlr4-runtime</artifactId> 
            <version>4.0</version>
        </dependency> 

        <dependency>
            <groupId>org.gigaspaces</groupId>
            <artifactId>xap-mongodb</artifactId>
            <version>16.4.0-m1</version>
            <scope>provided</scope>
        </dependency>
        ...
    </dependencies>

Setup

An example of how the MongoDB Space Synchronization Endpoint can be configured within a mirror.

    <?xml version="1.0" encoding="utf-8"?> 
    <beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
        xmlns:os-core="http://www.openspaces.org/schema/core" xmlns:os-jms="http://www.openspaces.org/schema/jms" 
        xmlns:os-events="http://www.openspaces.org/schema/events" 
        xmlns:os-remoting="http://www.openspaces.org/schema/remoting" 
        xmlns:os-sla="http://www.openspaces.org/schema/sla" xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.openspaces.org/schema/core http://www.openspaces.org/schema/16.4/core/openspaces-core.xsd
        http://www.openspaces.org/schema/events http://www.openspaces.org/schema/16.4/events/openspaces-events.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.openspaces.org/schema/remoting http://www.openspaces.org/schema/16.4/remoting/openspaces-remoting.xsd">
        
        <bean id="propertiesConfigurer" 
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" /> 
        
        <os-core:mirror id="mirror" url="/./mirror-service"
            space-sync-endpoint="spaceSynchronizationEndpoint" operation-grouping="group-by-replication-bulk">
            <os-core:source-space name="dataSourceSpace" partitions="2"
                backups="1" />

The number of backups per partition is zero or one.


        </os-core:mirror>
        
        <bean id="mongoClient"
            class="com.gigaspaces.persistency.MongoClientConnectorBeanFactory">
            <property name="db" value="qadb" />
            <property name="config">
                <bean class="com.mongodb.MongoClient">
                    <constructor-arg value="localhost" type="java.lang.String" />
                    <constructor-arg value="27017" type="int" />
                </bean>
            </property>
        </bean>
        
        <bean id="spaceSynchronizationEndpoint"
            class="com.gigaspaces.persistency.MongoSpaceSynchronizationEndpointBeanFactory">
            <property name="mongoClientConnector" ref="mongoClient" />
        </bean> 
    </beans>
        MongoClient config = new MongoClient(host, port);
        
        MongoClientConnector client = new MongoClientConnectorConfigurer()
                .client(config)
                .db(dbName)
                .create();  
        
        MongoSpaceSynchronizationEndpoint syncEndpoint = new MongoSpaceSynchronizationEndpointConfigurer() 
                .mongoClientConnector(client) 
                .create(); 
        
        IJSpace mirror = new EmbeddedSpaceConfigurer("mirror-service")
        .schema("mirror") 
        .spaceSynchronizationEndpoint(syncEndpoint) 
        .addProperty("space-config.mirror-service.cluster.name", "space") 
        .addProperty("space-config.mirror-service.cluster.partitions", String.valueOf(numOfPartitiones)) 
        .addProperty("space-config.mirror-service.cluster.backups-per-partition", String.valueOf(numOfBackups)) 
        .create();

The number of backups per partition is zero or one.

For more details about different configurations see Space Persistency.

Before you begin

Before deploying your Processing UnitClosed This is the unit of packaging and deployment in the GigaSpaces Data Grid, and is essentially the main GigaSpaces service. The Processing Unit (PU) itself is typically deployed onto the Service Grid. When a Processing Unit is deployed, a Processing Unit instance is the actual runtime entity., please do the following:

  1. Copy the xap-mongodb.jar from lib\optional\mongodb to lib\optional\pu-common.
  2. download the following jars and copy them to lib\optional\pu-common:

MongoSpaceSynchronizationEndpoint Properties

Property Description
client A configured com.gigaspaces.persistency.MongoClientConnector bean. Must be configured.

Considerations

  • Change API and Partial updates is supported