powered by Jive Software

Developing Plugins with Clustering

Hi,

Is there any official guide for developing plugins with clustering enbaled? Are there any special considerations?

A more specific question - I keep a large data structure that gets initialized with my plugin and lives throughout the life of the plugin (and the server for that matter). Whenever a packet is handled by the plugin it reads or writes some data to that “global” object. How do I go about making this data available in other nodes?

Thanks.

Sorry for bumping the thread, but am I the only one interested in this?

With th release of the new clustering beta, is there going to be an official doc?

Many thanks in advance.

Did you find a solution for this? I am also in need of finding a similar solution.

Have a look at the source code of Kraken plugin or the Fastpath plugin

public class MyPlugin implements Plugin, ClusterEventListener

{

public void initializePlugin(PluginManager manager, File pluginDirectory)
{
   ClusterManager.addListener(this);
}
   ..................
public void joinedCluster()
{
    }
public void joinedCluster()
{
  // just joined cluster, no more an island
  // release component  name until we become senior node
  componentManager.removeComponent(myComponentName);                           
}
public void joinedCluster(byte[] nodeID)
{
}
public void leftCluster()
{
  // left cluster, now an island
  // aquire component  name
 componentManager.addComponent(myComponentName, myComponentJID);   //
}
public void leftCluster(byte[] nodeID)
{
}
public void markedAsSeniorClusterMember()
{
  // we are now senior cluster node
  // aquire component  name
 componentManager.addComponent(myComponentName, myComponentJID);   

}

As far as I know, there’s no documentation on this feature. You’re actually quite free to pick whatever method you prefer. Typically, you’d want to create a shared cache, such as the ones provided by Oracle Coherence. Suchs a cache is essentially a Map, of which the data is available to every instance on the cluster. You can use Oracle Coherence based classes, but you’re free to include another framework (EHCache would make a good alternative, for example).

Thanks for the input, I appreciate it. I will try based on the code posted.