background image

A Message-Driven Bean Example

<< Handling Exceptions | simplemessage Application Client >>
<< Handling Exceptions | simplemessage Application Client >>

A Message-Driven Bean Example

A Message-Driven Bean Example
Message-driven beans can implement any messaging type. Most commonly, they implement
the Java Message Service (JMS) technology. The example in this chapter uses JMS technology,
so you should be familiar with basic JMS concepts such as queues and messages. To learn about
these concepts, see
Chapter 31, "The Java Message Service API."
This chapter describes the source code of a simple message-driven bean example. Before
proceeding, you should read the basic conceptual information in the section
"What Is a
Message-Driven Bean?" on page 634
as well as
"Using Message-Driven Beans to Receive
Messages Asynchronously" on page 956
in
Chapter 31, "The Java Message Service API."
simplemessage
Example Application Overview
The simplemessage application has the following components:
SimpleMessageClient
: An application client that sends several messages to a queue
SimpleMessageEJB
: A message-driven bean that asynchronously receives and processes the
messages that are sent to the queue
Figure 231
illustrates the structure of this application. The application client sends messages to
the queue, which was created administratively using the Admin Console. The JMS provider (in
this case, the Application Server) delivers the messages to the instances of the message-driven
bean, which then processes the messages.
23
C H A P T E R
2 3
675