Using JMS with the J2EE RI

The J2EE RI 1.4 is not pre-configured with any JMS resources. In order to use JMS you will have to create

  • A connection factory for queues

  • A connection factory for topics

  • Destination resources for each queue and topic you want to use

  • Physical destinations representing the actual queues and topics

This book is not a guide for administering J2EE RI, so the asant build files supplied on the accompanying Web site create the necessary connection factories, destination resources, and physical destinations required for today's examples. To create the required JMS resources, ensure you have started the J2EE RI default domain (as described on Day 2, “The J2EE Platform and Roles” and run the following command from the Day09/examples directory:

asant create-jms

Figure 9.4 shows the J2EE Administration Console view of the created JMS resources. For more information on creating JMS resources refer to the J2EE 1.4 tutorial available from http://java.sun.com/j2ee.

Figure 9.4. JMS Resources in Admin Console.


The resources used during today's examples and exercise are listed in Table 9.2.

Table 9.2. JMS Components
JNDI NameDescription
jms/QueueConnectionFactoryQueueConnectionFactory resource
jms/TopicConnectionFactoryTopicConnectionFactory resource
jms/firstQueueQueue resource mapped onto the PhysicalQueue destination
jms/bulletinBoardTopic resource mapped onto the PhysicalTopic destination
PhysicalQueuePhysical destination for a Queue
PhysicalTopicPhysical destination for a Topic

The J2EE specification recommends that JNDI names for JMS resources begin with the prefix jms/. In table 9.2 all the standard JMS components follow this naming convention. The physical destinations in Table 9.2 are a feature of the Message Server implementation provided with the J2EE RI and have been deliberately created without the jms/ prefix to highlight the proprietary nature of these resources.

You can delete the JMS resources with the command

asant delete-jms

Your example applications must be configured and run as J2EE Application Clients in order to access the Message Server resources provided with the J2EE RI (as discussed on Day 3, “Naming and Directory Services,” and Day 4, “Introduction to Enterprise JavaBeans.” The supplied asant build files define targets for running each of the examples using the J2EE RI appclient utility. To get a list of asant targets run the command

asant

from the Day09/examples directory.

NOTE

If you are working with a different Message Service provider you may be able to run the examples as a simple JVM application instead of wrapping them up as Application Clients.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.112.217