Creating Topic and Queue Connection Factories
In order to allow JMS clients to use the Universal Messaging Context Factory to reference objects via JNDI, we first of all need to create Topic and Queue connection factories. To do this, right click on the tree node labelled Topic Connection Factories and select the menu option New Topic Connection Factory. This will display a dialog box allowing you to enter the name for the connection factory. Enter any name (in this example, we will use the name TopicConnectionFactory). Click on OK when you've entered the name, and you will see that a new node will have been created under the Topic Connection Factories folder with the same name as you entered. The image below shows the JNDI namespace with a newly created topic connection factory:
The Topic Connection Factory object you just created is actually stored as an event, published onto the /naming/defaultContext channel. This event is what will be referenced by JMS clients when they attempt to find the details for the connection factory.
When JMS clients use the Universal Messaging Initial Context for JNDI, they also reference the topics and queues from the same Initial Context. In order for these clients to access these objects we need to create references to each topic and queue. Creating such references will also create the underlying channel or queue if it does not already exist; note that channels or queues created in this way will have the same default permissions as channels or queues created manually.
In this example, we will add a new topic into the JNDI namespace that corresponds to a Universal Messaging channel that already exists as a cluster channel. To do this, first, right-click on the folder called Topics within the JNDI namespace, and select the menu option New Topic. If we enter the name /customer/sales, then a new object will be created under the Topics folder called /customer/sales. This is because, under the covers, a corresponding event was published to the/naming/defaultContext channel. JMS clients can thus look up the reference to this topic (channel) and begin using it within their application. The following image shows the newly created Topic within the JNDI namespace for the existing topic /customer/sales:
Once we have created both the topic connection factory and the topic, we can snoop (see
Channel Snoop) the
/naming/defaultContext channel to view the individual events that represent these references. If you click the
/naming/defaultContext channel within the Enterprise Manager namespace, then the
Snoop panel, and click
Startyou will see the events representing the JNDI entries that have been created. By selecting on any of the events you will then see the content of each event on the channel and the corresponding JNDI context information given to the JMS applications that will require it.
The image below shows an example of the Topic Connection Factory created earlier using the JNDI panel: