Contents

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 name spacesnamespaces.

Note
  • 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

...

 

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

Code Block
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());
}

...

  1. Launch Fiorano Studio and connect Studio 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 on the Topics node and select Add Topic

Image RemovedImage Added

The below window below is gets displayed:.

Image Modified

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

 

Note

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

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

Image Modified

Adaptavist ThemeBuilder EngineAtlassian Confluence