This page describes an older version of the product. The latest stable version is 16.4.

Archive Handler


The Archive Container can be configured to work against MongoDB (without writing any extra code). The ArchiveOperationHandler interface abstracts the Big-Data storage from the Archive Container. The MongoDB Archive Operation Handler implements this interface by serializing space objects into MongoDB.

archive-container-mongodb.jpg

Library dependencies

The MongoDB Archive Operation Handler uses the MongoDB driver for communicating with the MongoDB cluster. Include the following in your pom.xml

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>2.11.2</version>
</dependency>

<dependency>
    <groupId>com.allanbank</groupId>
    <artifactId>mongodb-async-driver</artifactId>
    <version>1.2.3</version>
</dependency>

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

<dependency>
    <groupId>commons-pool</groupId>
    <artifactId>commons-pool</artifactId>
    <version>1.4</version>
</dependency>

Setup


<bean id="mongoArchiveHandler" class="com.gigaspaces.persistency.archive.MongoArchiveOperationHandler">
    <property name="gigaSpace" ref="gigaSpace" />
    <property name="config" ref="config" />
    <property name="db" value="${mongodb.db}" />
</bean>

ArchiveOperationHandler cassandraArchiveHandler =
    new MongoArchiveOperationHandlerConfigurer()
     .gigaSpace(gigaSpace)
     .config(config)
     .db("mydb")
     .create();

// To free the resources used by the archive container make sure you close it properly.
// A good life cycle event to place the destroy() call would be within the @PreDestroy or DisposableBean#destroy() method.

archiveContainer.destroy();

MongoArchiveOperationHandler Properties

Property Description
gigaSpace GigaSpace reference used for type descriptors. see Archive Container
config MongoClientConfiguration reference used to handle the mongodb driver configuration. see MongoClientConfiguration
db mongodb database name