U S I N G T H E J M S A P I
a QueueConnectionFactory and Listing 11 2, looking up a TopicConnectionFactory shows
you the typical way the OIL ConnectionFactory is created in a client application.
Listing 11 1, looking up a QueueConnectionFactory
InitialContext ctx = new InitialContext();
QueueConnectionFactory qcf=(QueueConnectionFactory)ctx.lookup( ConnectionFactory );
Listing 11 2, looking up a TopicConnectionFactory
InitialContext ctx = new InitialContext();
TopicConnectionFactory qcf=(TopicConnectionFactory)ctx.lookup( ConnectionFactory );
A ConnectionFactory can also be constructed without using JNDI via JBossMQ specific APIs
but it out of the scope of this document.
Looking up Queues and Topics
Once you have a ConnectionFactory, the next thing you will need to do is find out how to get
the Destination (Queue and Topic) objects. There are two ways you can get references to the
Destination objects.
1.
Use JNDI to lookup the Destination object.
Queues are stored under the queue subcontext. Therefore, to lookup a queue
named queueName, the JNDI location you would look up should be
queue/queueName .
Topics are stored under the topic subcontext. Therefore, to lookup a topic
named topicName, the JNDI location you would look up should be
topic/topicName .
2.
Use the QueueSession.createQueue( String queueName ) or
TopicSession.createTopic( String topicName ) methods. These methods do not
create NEW Destinations, they create references to existing Destinations.
Configuring JBoss JMS Objects
All JBoss JMS object such as the ConnectionFactorys, Topics and Queues are configured via
a JMX MBean
10
. In addition to the standard JMS objects, there are also JMX MBean that
10
See the Error! Reference source not found. chapter for more info on MBeans.
102
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved