What Are Message-Driven Beans?

Message-Driven Beans (MDBs) are generally constructed to be message consumers, although they can, like any other EJB, also be used to create and send messages. An MDB lives entirely within the container; it has no security context of its own. When the bean is deployed, it is associated with a particular queue or topic, and is invoked by the container when a message arrives for that queue or topic.

The following are the features of a Message-Driven bean:

  • It is anonymous; that is, it has no client visibility. No state is maintained for the client.

  • All instances of a particular Message-Driven bean are equivalent.

  • The container can pool instances.

  • It does not have a local or remote interface.

  • It is invoked asynchronously ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.