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 on the Hazelcast Community Edition. You can plug your own clustering implementation to the product by using the ClusteringAgent extension point in WSO2 Carbon.
...
WSO2 Carbon uses a modified version of the interface for Clustering Agent that is provided by Axis2. You can find the WSO2 version here. You can have your own clustering implementation by using this interface and overriding the relevant methods.
Following is the list of methods in this interface that you can override to have your own clustering implementation:
METHOD | DESCRIPTION |
---|---|
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 for 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 shuts down. 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. |
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 implementation 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 to which the ClusteringAgent belongs. |
boolean isCoordinator(); | Should check whether this member is the coordinator for the cluster. |
...