Universal Messaging 10.11 | Administration Guide | Universal Messaging Administration API | Namespace Objects | nRealmNode
 
nRealmNode
Universal Messaging's namespace contains objects that can be administered, monitored and configured. The nRealmNode object in the nAdminAPI, corresponds to a Universal Messaging Realm server process. The nRealmNode is used to make an admin connection to a realm.
In order to connect to a realm you need to ensure you are familiar with the concept of an RNAME. Once you have the RNAME that corresponds to your realm, you can then construct the nRealmNode and connect to the corresponding realm. This is achieved by the following calls:
Java:
String[] RNAME={"nsp://127.0.0.1:9000"};

nSessionAttributes nsa=new nSessionAttributes(RNAME);

nRealmNode realm = new nRealmNode(nsa);

C++:
std::string rName = "nsp://127.0.0.1:9000";

nSessionAttributes* nsa=new nSessionAttributes(rName);

nRealmNode* realm = new nRealmNode(nsa);
By constructing an nRealmNode, and connecting to a realm, the realm node will automatically begin receiving status information from the realm periodically, as well as when things occur.
nRealmNode
The nRealmNode is the root of a Universal Messaging Realm's namespace, which is a tree like structure that contains child nodes. The tree nodes are all subclasses of a base class nNode. Each node corresponds to one of the following node subclasses:
*nRealmNode - other realm nodes that have been added to this realm's namespace
*nContainer - folders, if there was a channel called /eur/uk/rates, there would be a child nContainer node called, 'eur' which would have a child called 'uk' etc.
*nLeafNode - these correspond to channels and queues
*nDurableNode - represents the status of a durable object.
The nRealmNode itself is a subclass of the nContainer class. To obtain an enumeration of all child nodes within a realm node, simply call the following:
Java:
Enumeration children = realm.getNodes();
C#:
System.Collections.IEnumerator children = realm.getNodes();
C++:
fSortedList nodes = pNode->getNodes();
Once you have this enumeration of nodes, you can then perform the various operations on those nodes available through the nAdminAPI.
If you know the name of the child node you wish to obtain a reference to, you can use the following method:
Java:
nNode found = realm.findNode("/eur/uk/rates");
C++:
nNode* found = realm->findNode("/eur/uk/rates");
Which should return you an nLeafNode that corresponds to the channel called '/eur/uk/rates'.
As well as obtaining references to existing nodes, it is also possible to create and delete channels and queues using the nRealmNode. For example, to create a channel called '/eur/fr/rates', we would write the following code:
nChannelAttributes cattrib = new nChannelAttributes();
cattrib.setMaxEvents(0);
cattrib.setTTL(0);
cattrib.setType(nChannelAttributes.SIMPLE_TYPE);
cattrib.setName(“/eur/fr/rates”);
nLeafNode channel = realm.createChannel(cattrib);
C++:
nChannelAttributes* cattrib = new nChannelAttributes();
cattrib->setMaxEvents(0);
cattrib->setTTL(0);
cattrib->setType(nChannelAttributes.SIMPLE_TYPE);
cattrib->setName(“/eur/fr/rates”);
nLeafNode* channel = realm->createChannel(cattrib);
To remove channel or a queue, you can simply call the following method on your realm node (using the channel created above):
realm.delLeafNode(channel);
C++:
realm->delLeafNode(channel);
For more information on Universal Messaging Administration, please see the API documentation, and the Enterprise Manager Guide.