Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Clustering is an important feature in WSO2 products, which provides high-availability and high-scalability. You can read more on clustering wso2 products here.By default, wso2 products provide Hazelcast Community Edition based Clustering implementation. If required, users can plug their own clustering implementation Clustering is an important feature in WSO2 products, which provides high-availability and high-scalability. By default, WSO2 products provide a clustering implementation that is based on Hazelcast Community Edition. You can plug your own clustering implementation to the product by using the ClusteringAgent extension point in WSO2 Carbon.

...

Writing your own clustering implementation

WSO2 Carbon uses a modified version of the interface for Clustering Agent that is provided by Axis2. You can find it the WSO2 version here. You can have your own clustering implementation by using this interface . You can find the default clustering agent in WSO2 Carbon from here.Following are the methods from and overriding the relevant methods. 

 Following is the list of methods in this interface that you need to overridecan override to have your own clustering implementation:

METHODDESCRIPTION

void init()

Should contain the implementation logic for Initializing the node and joining the cluster

List<ClusteringCommand> sendMesssge(ClusteringMessage message, boolean isRpcMessage)

Should contain the implementation logic for sending a message to all members in this member's primary cluster

void setMembers(List<Member> members)

Should set the static members of the cluster

void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain)

Should contain the implementation logic for adding a GroupManagementAgent for an application domain

void addGroupManagementAgent(GroupManagementAgent agent, String applicationDomain,String applicationSubDomain, int groupMgtPort)

Should contain the implementation logic for adding a GroupManagementAgent for an application domain and sub-domain

void resetGroupManagementAgent(String applicationDomain, String applicationSubDomain)

Should contain the implementation logic for resetting the GroupManagementAgent corresponding to an application domain and a sub-domain and clearing all the members of the corresponding GroupManagementAgent

GroupManagementAgent getGroupManagementAgent(String applicationDomain)

Should contain the implementation logic for getting the GroupManagementAgent which corresponds to the applicationDomain. This will be valid only when this node is running in groupManagement

GroupManagementAgent getGroupManagementAgent(String applicationDomain, String applicationSubDomain)

Should contain the implementation logic for getting the GroupManagementAgent which corresponds to the applicationDomain and sub-domain

void shutdown()

Should contain the implementation logic for disconnecting this node from the cluster. This node will no longer receive membership change notifications, state change messages or configuration change messages. The node will be standing alone once it is shutdown. However, it has to continue to process Web service requests

List<Member> getMembers()

Should contain the implementation logic for getting the list of members in a static group

void stop()

Should contain the implementation logic for cleaning up and leaving the cluster

void setStateManager(StateManager stateManager)

Should contain the implementation logic for setting the StateManager corresponding to this ClusteringAgent. This is an optional attribute.
We can have a cluster with no context replication, in which case the contextManager will be null. This value is set by the org.apache.axis2.deployment.ClusterBuilder, by reading the  "contextManager" element in the axis2.xml

NodeManager getNodeManager()

Should return the NodeManager

void setNodeManager(NodeManager nodeManager)

Should contain the implementation logic for setting the NodeManager corresponding to this ClusteringAgent. This is an optional attribute. We can have a cluster with no configuration management, in which case the configurationManager will be null. This value is set by the org.apache.axis2.deployment.ClusterBuilder, by reading the  "configurationManager" element in the axis2.xml

void setConfigurationContext(ConfigurationContext configurationContext)

Should set the system's configuration context. This will be used by the clustering implementations to get information about the Axis2 environment and to correspond with the Axis2 environment

int getAliveMemberCount()

Should set the number of members alive

Set<String> getDomains()

Should get all the domains that this ClusteringAgent belongs to

boolean isCoordinator();

Should check whether this member is the coordinator for the cluster

...