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:
nSessionAttributes nsa=new nSessionAttributes(RNAME);
nRealmNode realm = new nRealmNode(nsa);
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.
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:
- other realm nodes that have been added to this realm's namespace
- 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.
- these correspond to channels and queues
- these correspond to p2p services.
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:
Enumeration children = realm.getNodes();
System.Collections.IEnumerator children = realm.getNodes();
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:
nNode found = realm.findNode("/eur/uk/rates");
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();
nLeafNode channel = realm.createChannel(cattrib);
nChannelAttributes* cattrib = new nChannelAttributes();
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):
For more information on Universal Messaging Administration, please see the API documentation, and the Enterprise Manager Guide