Programming Interfaces in a Message-Driven Bean

There are a number of constraints on the contents of a Message-Driven Bean class which must

  • Implement the javax.ejb.MessageDrivenBean interface

  • Implement the javax.jms.MessageListener interface

  • Have a single constructor, with no arguments

  • Have a single public setMessageDrivenContext(MessageDrivenContext ctx) method that returns void

  • Have a single public ejbCreate() method with no arguments that returns void

  • Have a single public ejbRemove() method with no arguments that returns void

  • Have a single public onMessage(Message message) method that returns void

  • Not have a finalize() method

The following sections cover these methods in more detail.

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.