Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

Motivation for Message-Driven Beans


In enterprise scale environments we would like our messaging systems to take advantage of the services offered by an EJB container. These include security, transactions, concurrency, and the scalability of the EJB model. A session bean cannot be a message consumer since its business methods must be synchronously invoked by a client. However, a session bean can act as a message producer as we shall see. To meet these requirements, EJB provides message-driven beans (MDBs). An added bonus of MDBs is that much of the boilerplate code of creating and starting connections and creating sessions and listeners is dispensed with.

MDBs are EJB components which act as asynchronous message consumers. Since EJB 2.1, MDBs can support non-JMS messaging systems as well as JMS messaging systems, but we will describe only JMS-based MDBs in this book.

MDBs do not have remote or local business interfaces. JMS-based MDBs must implement the MessageListener interface. As we have...