background image

Using the JMS API with a Session Bean

<< Java EE Examples Using the JMS API | Coding the Application Client >>
<< Java EE Examples Using the JMS API | Coding the Application Client >>

Using the JMS API with a Session Bean

A Java EE Application That Uses the JMS API with a Session
Bean
This section explains how to write, compile, package, deploy, and run a Java EE application that
uses the JMS API in conjunction with a session bean. The application contains the following
components:
An application client that invokes a session bean
A session bean that publishes several messages to a topic
A message-driven bean that receives and processes the messages using a durable topic
subscriber and a message selector
The section covers the following topics:
"Writing the Application Components for the clientsessionmdb Example" on page 964
"Creating Resources for the clientsessionmdb Example" on page 967
"Building, Deploying, and Running the clientsessionmdb Example Using NetBeans IDE"
on page 967
"Building, Deploying, and Running the clientsessionmdb Example Using Ant" on page 969
You will find the source files for this section in the directory
tut-install/javaeetutorial5/examples/jms/clientsessionmdb/. Path names in this section
are relative to this directory.
Writing the Application Components for the
clientsessionmdb
Example
This application demonstrates how to send messages from an enterprise bean (in this case, a
session bean) rather than from an application client, as in the example in
Chapter 23, "A
Message-Driven Bean Example." Figure 32­1
illustrates the structure of this application.
A Java EE Application That Uses the JMS API with a Session Bean
The Java EE 5 Tutorial · September 2007
964