SyntaxHighlighter

Wednesday, June 19, 2013

GemFire - Starting An ApplicationContext on the Gemfire Node

GemFire - Starting An ApplicationContext on the GemFire Node

so in digging around in a use case that a colleague mentioned, there's a feature that is part of GemFire that allows for the invocation of a class after the cache is initialized (on a server).  this is neat little piece of functionality which allows for spooling up of components on the actual cache server side.

why would you do this? startup a spring application context for sharing amongst cache listeners?

so, here's a quick sample; first the cache.xml


  
  
  
   de.incompleteco.gemfire.initializer.Initializer
  


and now the class

package de.incompleteco.gemfire.initializer;

import java.util.Properties;

import com.gemstone.gemfire.cache.Declarable;

public class Initializer implements Declarable {

 public void init(Properties properties) {
  //put some stuff here --> maybe an app context
 }

 
}

No comments:

Post a Comment