Universal Messaging 9.12 | Administration Guide | Universal Messaging Administration API | Management Information | nRealmNode
 
nRealmNode
The Universal Messaging admin API provides real time asynchronous management 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 nRealmNode object 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 nRealmNode object:
Status Information
The nRealmNode extends nContainer, that extends nNode which is a subclass of Observable, so when the status information is received for a realm node, (by default this is every 5 seconds although it is configurable (see Realm Configuration) by setting the StatusBroadcast property under the Global Values config group) the nRealmNode will trigger the update callback on any known Observers. For example, if you write a class that implements the Observer interface, it can be added as an observer as follows:
Java, C#, C++:
realm.addObserver(this);
Assuming 'this' is the instance of the class implementing Observer, then the implementation of the update(Observable obs, Object obj) will be notified that the realm node has changed.
When regular status events are sent, the Observable object referenced in the update method will be the realm node that you added your observer to, and the Object will be null.
State Change Events
When events occur on a realm node that you have added an observer to, the Observable/Observer mechanism will notify you of the details of that event. For example, the following implementation of the update method of the Observer interface demonstrates how to detect that a new channel or queue has been created or deleted :
Java, C#:
public void update(Observable obs, Object obj){
if (obs instanceof nContainer) {
if (obj instanceof nLeafNode) {
nLeafNode leaf = (nLeafNode)obj;
nContainer cont = (nContainer)obs;
if (cont.findNode(leaf) == null) {
// node has been deleted
System.out.println("Node "+leaf.getName()+" removed");
} else {
// node has been added
System.out.println("Node "+leaf.getName()+" added");
}
}
}
}
C++:
void ObservableMapping::update(Observable *pObs, void *pObj)
{
if (obs->getType() == fBase::CONTAINER) {
if (obj->getType() == fBase::LEAFNODE) {
nLeafNode leaf = (nLeafNode*)obj;
nContainer cont = (nContainer*)obs;
if (cont->findNode(leaf)) {
// node has been deleted
printf("Node %s removed",leaf->getName());
System.out.println("Node "+leaf.getName()+" removed");
} else {
// node has been added
printf("Node %s added",leaf->getName());
}
}
}
}
Any changes to the realm ACL will also use the same notification mechanism. For example, if an ACL entry was changed for a realm, the update method would be fired calling with the realm node object and the nACLEntry that had been modified.
Logging and Audit
An nRealmNode allows you to asynchronously receive realm log file entries as well as audit file entries as they occur.
Firstly, for receiving asynchronous log file entries, there is an interface called nLogListener which your class must implement. This interface defines a callback method called report(String) that will deliver each new log entry as a string. Once implemented, the following call will add your log listener to the realm node:
Java, C#, C++:
realm.addLogListener(this);
Assuming 'this' is the instance of the class implementing the nLogListener interface.
The following is an example of the report(String) method implementation:
Java, C#:
public void report(String msg) {
System.out.println("LOG "+msg);
}
C++:
printf("Log : %s\n", msg);
Secondly, realm servers provide an audit file that tracks object creations and deletions, acl changes, connection attempts and failures. This information can be very useful for tracking who has created ACL entries for example and when they were done.
This information, as with log file entries can be asynchronously received by implementing an interface called nAuditListener. This interface defines a callback method called audit(nAuditEvent) that delivers contains the details of the audit entry. Once implemented, the following call will add your log listener to the realm node:
Java, C#, C++:
realm.addAuditListener(this);
Assuming 'this' is the instance of the class implementing the nAuditListener.
For more information on Universal Messaging Administration, please see the API documentation, and the Enterprise Manager Guide.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.