Skip to content

Instantly share code, notes, and snippets.

@idanmo
idanmo / gs-mongodb-ssa.java
Created January 20, 2013 08:52
GigaSpaces MongoDB persistency example implementation
public class MongoDbSpaceSynchronizationEndpoint extends SpaceSynchronizationEndpoint {
private DB db = ... // MongoDB database object
@Override
public void onOperationsBatchSynchronization(final OperationsBatchData data) {
// Get the MongoDB collection that will be used for persisting space documents
DBCollection collection = db.getCollection("spaceDocuments");
// Persist each of the space documents in this batch
for (DataSyncOperation operation : data.getBatchDataItems()) {
// Handle only write operations which are document supported