J2EE Messaging
911
Message-Driven Bean Clients
Because a message-driven bean has no home or remote interface, it may not be accessed directly by a
client. Instead, the client sends a message to the destination that the bean is listening on. A message-driven
bean instance has no identity; a client cannot distinguish between two instances of a message-driven bean
class. In fact, to a client, a message-driven bean is simply seen as a JMS message consumer. In other words
a message-driven bean client is simply a JMS message producer. EJB session, entity beans, and message-
driven beans can be JMS message producers and can, therefore, be message-driven bean clients.
Summary
In this chapter we learned that:
q
Messaging is a useful way to create loosely-coupled applications.
q
Messaging provides a means of asynchronous communication between parts of an application
or between multiple applications.
q
JMS is an API for messaging that offers both of the major messaging models,
Publish/Subscribe (Pub/Sub) and Point-to-Point (PTP). The JMS specification belongs to the
javax.jms package.
q
JMS and XML are good tools for application integration. JMS provides a means of
communication between systems and XML provides a simple way to store portable data.
q
The message-driven bean is a new type of EJB that allows developers to easily create message
consumers for either messaging model (Pub/Sub or PTP).
The complete JMS specification is online at http://java.sun.com/products/jms/docs.html. The complete
EJB specification is online at http://java.sun.com/products/ejb/docs.html.