The Message-Driven Bean Class

The code for the SimpleMessageEJB class illustrates the requirements of a message-driven bean class:

  • It implements the MessageDrivenBean and MessageListener interfaces.

  • The class is defined as public.

  • The class cannot be defined as abstract or final.

  • It implements one onMessage method.

  • It implements one ejbCreate method and one ejbRemove method.

  • It contains a public constructor with no arguments.

  • It must not define the finalize method.

Unlike session and entity beans, message-driven beans do not have the remote or local interfaces that define client access. Client components do not locate message-driven beans and invoke methods on them. Although message-driven beans do not have business methods, they may contain helper ...

Get J2EE™ Tutorial, The 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.