Universal Messaging Developer Guide : Enterprise APIs : Enterprise Developer's Guide for Java : Provider for JMS : JMSAdmin
JMSAdmin
Universal Messaging's Enterprise Manager tool supports JNDI using the same Universal Messaging Channel based context used by the JMSAdmin example.
The example (jmsdmin.Java) source code demonstrates how to store Universal Messaging Provider for JMS components into a JNDI service provider. The default service provider for the example uses Universal Messaging's own Universal Messaging Context to store JMS objects references, however any JNDI context provider can be used, from LDAP through to NIS. The Universal Messaging context is discussed in more detail here. The Universal Messaging Context stores references in a channel called /naming/defaultContext.
JMSAdmin creates all required resources on a Universal Messaging realm. Example usage is as follows:
Java -DRNAME [-DPRINCIPAL] [-DPASSWORD] -DCONTEXT_FACTORY
-DPROVIDER_URL JMSAdmin bind | unbind | list | queueFactory |
topicFactory |connectionFactory | queue | topic name / alias
where:
RNAME is the realm name of the Universal Messaging server you wish to connect to. If no RNAME is provided the default RNAME of nsp://localhost:9000 is used.
PRINCIPAL is the subject (if any) your JNDI service provider requires.
PASSWORD is the PRINCIPAL's password for the JNDI service provider used.
CONTEXT_FACTORY is the fully qualified class name of the providers context factory implementation. The default CONTEXT FACTORY is com.pcbsys.nirvana.nSpace.NirvanaContextFactory and is set automatically if no CONTEXT_FACTORY parameter is provided.
PROVIDER_URL is the custom URL required by the context factory and provider implementation. If no PROVIDER_URL parameter is passed, the default used is nsp://localhost:9000/.
As an example, assume we want to create a TOPIC called rates on a Universal Messaging realm running on our local machine. Typing:
Java com.pcbsys.nirvana.nSpace.JMSAdmin bind topic rates
Will create an event in the /naming/defaultContext channel with the following information in the event properties of the event:
rates/RefAddr/0/Content=rates
rates/RefAddr/0/Type=Topic
rates/ClassName=javax.JMS.Topic
rates/FactoryName=com.pcbsys.nirvana.nJMS.TopicFactory
rates/RefAddr/0/Encoding=String
The topic rates will automatically be created on the Universal Messaging realm running on the PROVIDER_URL value. Assuming you wish to reference your local realm as a TopicConnectionFactory named TopicConnectionFactory in JMS, use the following command:
Java com.pcbsys.nirvana.nSpace.JMSAdmin bind topicFactory TopicConnectionFactory
This will publish an event to the /naming/defaultContext channel with the following information in the event dictionary:
TopicConnectionFactory/RefAddr/0/Type=TopicConnectionFactory
TopicConnectionFactory /FactoryName=com.pcbsys.nirvana.nJMS.TopicConnectionFactoryFactory
TopicConnectionFactory/RefAddr/0/Encoding=String
TopicConnectionFactory/ClassName=javax.JMS.TopicConnectionFactory
TopicConnectionFactory/RefAddr/0/Content=nsp\://127.0.0.1\:9000
TopicConnectionFactory/RefAddr/0/Encoding=String
Creating a queue can be achieved using the following command:
Java com.pcbsys.nirvana.nSpace.JMSAdmin bind queue movie
Likewise, a JMS Queue connection factory called QueueConnectionFactory can be bound into a name space using the following command
Java com.pcbsys.nirvana.nSpace.JMSAdmin bind queueFactory QueueConnectionFactory
Having run both queue related commands, the /naming/defaultContext channel will contain 4 events, each one pertaining to the 4 objects that have been bound, namely TopicConnectionFactory, QueueConnectionFactory, rates and movie. The Universal MessagingContext used with your JMS application will now be able to look up these objects and use them within your application.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback