Universal Messaging 10.5 | Administration Guide | Universal Messaging Administration API | Management Information | nClusterNode
 
nClusterNode
Universal Messaging's admin API provides real time asynchronous information on all objects within a realm server. By creating an nRealmNode (see nRealmNode), and connecting to a realm, information is automatically delivered to the realm node from the realm. This information is delivered periodically in summary form, and also as and when the state changes for one or all of the objects managed within a realm.
Before reading this section it may be useful to look at the management information available via the Universal Messaging enterprise manager. A full description of all Realm management screens is available in the enterprise manager guide. All functionality seen in the enterprise manager can be easily added to bespoke admin and monitoring processes as it is written entirely using the Universal Messaging Admin API.
This section discusses the following different types of information that can be obtained through the nAdmin API for the nClusterNode object. The nClusterNode corresponds to a cluster that 2 or more realms are members of. Each nRealmNode will have access to its cluster node object once it has been added to a new or existing cluster:
Status Information
Firstly, in order to detect that a cluster node has been created, one has to observer the realm to which you are connected. When the realm is added to a cluster, the Observer/Observable mechanism will notify you of the cluster creation.
As well as implementing the Observer interface to detect new clusters, there is an interface that can be used to be notified of specific cluster events when clusters already exist. This interface is the nClusterEventListener. The interface defines various methods that enable your program to receive callbacks for specific cluster events. When the status changes for a cluster node, this will trigger an callback on any known listeners of the nClusterNode. For example, when you have constructed your nRealmNode, if your class implements the nClusterEventListener interface, then we can do the following:
Java, C#:
realm.addObserver(this);
nClusterNode cluster = realm.getCluster();
if (cluster != null) {
cluster.addListener(this);
}
C++:
pRealm->addObserver(this);
nClusterNode *pCluster = pRealm->getCluster();
pCluster->addListener(this);
If the realm is not part of a cluster, then the getCluster() method will return null. However, by adding an observer to the realm, if a cluster is created that contains the realm you are connected to, the update() method of the Observer implementation will notify you that a cluster has been created. For example, the following code demonstrates how to detect if a cluster has been created with the realm you are connected to as a member:
Java, C#:
public void update(Observable o, Object arg) {
if (arg instanceof nClusterNode) {
System.out.println("New cluster formed, name = "+( (nClusterNode)arg).getName());
((nClusterNode)arg).addListener(this);
}
}
C++:
nNode *pNode = iterator->second;
int type = pNode->getType ();
if (type == fBase::LEAFNODE)
{
((nLeafNode*)pNode)->addListener(new nChannelWatch((nLeafNode*)pNode, this));
}
For more information on how to monitor cluster nodes programmatically please see the appropriate code example.
For more information on how to monitor cluster nodes using the enterprise manager please see the enterprise manager guide.
For more information on Universal Messaging Administration, please see the API documentation and the Enterprise Manager Guide.