Skip to main content
Skip table of contents

15.1 Creating a Hierarchical Topic

15.1.1 Admin API

The User can create Hierarchical Topics with the help of AdminAPIs. The code snippet below demonstrates the process of the creation of topics in Hierarchical namespaces.

  • Queue, Topic and ConnectionFactory names cannot have any of these characters * # / : | ? " < >

To create a Topic, it is necessary that the parent to the topic exists:

CODE
public void testHierarchicalTopics ()
{
// create the initial context and connect to FioranoMQ 9
Hashtable env = new Hashtable ();
env.put (Context.SECURITY_PRINCIPAL, "anonymous");
env.put (Context.SECURITY_CREDENTIALS, "anonymous");
env.put (Context.PROVIDER_URL, "http://localhost:1856");
env.put Context.INITIAL_CONTEXT_FACTORY,"fiorano.jms.runtime.naming.FioranoInitialContextFactory");
InitialContext ic = new InitialContext (env); 
System.out.println ("Created InitialContext:: " + ic);
MQAdminConnectionFactory acf =
(MQAdminConnectionFactory) ic.lookup ("primaryACF");
MQAdminConnection ac = acf.createMQAdminConnection ("admin", "passwd");
System.out.println ("Created Admin Connection...");
MQAdminService adminService = ac.getMQAdminService ();
System.out.println ("Received handle to Admin services:: " + adminService); 
// Create a topic named primaryTopic.subTopic1
String topicName = "primarytopic.subtopic1";
TopicMetaData tMetaData = new TopicMetaData();
tMetaData.setName (topicName);
adminService.createTopic (tMetaData);
Topic topic = (Topic) ic.lookup (topicName);
System.out.println ("Looked up the Hierarchical Topic ", topic.getName()); 
//create a topic named primarytopic.subtopic2
String topicName = "primarytopic.subtopic2";
TopicMetaData tMetaData = new TopicMetaData ();
tMetaData.setName (topicName);
adminService.createTopic (tMetaData);
topic = (Topic) ic.lookup (topicName);
System.out.println ("Looked up the Hierarchical Topic ", topic.getName());
}

15.1.2 eStudio

The User can create Hierarchical Topics with admin Studio. To create hierarchical topics with eStudio, follow the steps below:

  1. Launch Fiorano eStudio and connect eStudio to the FioranoMQ Server.
  2. To create a topic, navigate to the Topics sub-node under the Destinations node of the tree
  3. Right-click the Topics node and select Add Topic

The below window gets displayed.

4. Enter the Destination parameter and other relevant parameters necessary for the creation of the topic. In this example, the Topic name is ABC.1

 

For the creation of topicName ABC.1, a parent topic should exist. In the absence of ABC, the following error is displayed on the console:


5. In the same manner, the user can create the topics hierarchy

After a hierarchy is created, all the topics are displayed in the Topic List.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.