Universal Messaging 10.11 | Administration Guide | Universal Messaging Administration API | Namespace Objects | nLeafNode (Channels and Queues)
 
nLeafNode (Channels and Queues)
Before you use the administration objects associated with the namespace of a realm, you should understand:
*The concept of the Universal Messaging Namespace, as discussed in the nRealmNode guide (see nRealmNode).
*The publish/subscribe and message queue functions of Universal Messaging.
*The concept of the nRealmNode and how to create it.
nLeafNode
The nLeafNode is either a channel or a queue, and is, as its name suggests, an end point of a branch of the namespace tree. The parent of an nLeafNode is always an instance of nContainer. Since nRealmNode is a subclass of nContainer, sometimes the parent of an nLeafNode is also an instance of an nRealmNode. For example, consider the following 2 channels within the namespace:
/eur/uk/rates
/rates
The nLeafNode that corresponds to the channel '/eur/uk/rates' will have a parent which is an instance of nContainer, and is called 'uk', whereas the nLeafNode that corresponds to the channel '/rates' has a parent which is also an instance of nContainer, however is is also an instance of an nRealmNode (i.e. the namespace root), since it does not contain any folder information in its name.
When channels and queues are created, they are added to the tree structure of the nRealmNode as nLeafNodes. Universal Messaging adds the nLeafNode automatically, but will send notifications to indicate that the namespace structure has changed so that the application handles the changes. For more details about managing the structure, see the "Management Information" section in this guide.
To determine if an nLeafNode is a channel or a queue, you can use one of the methods in the following code snippets to search the namespace and print out whether each leaf node it finds is a channel or a queue.
Example : Find channels and queues in the namespace
Java:
public void searchNodes(nContainer container)

Enumeration children = container.getNodes();
while (children.hasMoreElements()) {
nNode child = (nNode)children.nextElement();
if (child instanceof nContainer) {
searchNodes((nContainer)child);
} else if (child instanceof nLeafNode) {
nLeafNode leaf = (nLeafNode)child;
if (leaf.isChannel) {
System.out.println("Leaf Node "+leaf.getName()+" is a channel");
} else if (leaf.isQueue()) {
System.out.println("Leaf Node "+leaf.getName()+" is a queue");
}
}
}

}
C#:
public void searchNodes(nContainer container)

System.Collections.IEnumerator children = realm.getNodes();
while (children.MoveNext()){
nNode child = (nNode)children.Current;
if (child is nContainer) {
searchNodes((nContainer)child);
} else if (child is nLeafNode) {
nLeafNode leaf = (nLeafNode)child;
if (leaf.isChannel) {
Console.WriteLine("Leaf Node "+leaf.getName()+" is a channel");
} else if (leaf.isQueue()) {
Console.WriteLine("Leaf Node "+leaf.getName()+" is a queue");
}
}
}

}
C++:
void searchNodes(fSortedList nodes)
for (fSortedList::iterator iterator = nodes.begin(); iterator != nodes.end(); iterator++)
{
nNode *pNode = iterator->second;
int type = pNode->getType ();

if (type == fBase::LEAFNODE)
{
if(iterator->second->isChannel()){
printf("Leaf Node %s is a Channel");
} else if(iterator->second->isQueue()){
printf("Leaf Node %s is a Queue");
}
}

else if (type == fBase::CONTAINER)
{
searchNodes(((nContainer*)pNode)->getNodes());
}
}
}
In the above code example, by the searchNodes(realm) method searches the namespace from the realm node, and this isChannel() and isQueue() methods are used to determine whether each leaf node is a queue or a channel.
Associated with each leaf node, is the nChannelAttributes for the queue or channel, this is obtained by using the getAttributes() method, so it is possible to determine the characteristics of each leaf node.
Each leaf node also has an associated nACL object that can be modified to change security permissions for users. This is discussed in more detail in the security section of this guide.
For more information on Universal Messaging Administration, please see the API documentation, and the Enterprise Manager Guide.