Chapter 4.  EJB 3.0 Message-Driven Bean Component Contract

Develop code that implements a Message-Driven Bean Class.

[Note]

Message-Driven Bean Class

The following are the requirements for the message-driven bean class:

  • The class MUST implement, directly or indirectly, the message listener interface required by the messaging type that it supports or the methods of the message listener interface. In the case of JMS, this is the javax.jms.MessageListener interface.

  • The class MUST be defined as public, MUST NOT be final, and MUST NOT be abstract. The class must be a top level class.

  • The class MUST have a public constructor that takes NO arguments. The container uses this constructor to create instances of the message-driven bean class.

  • The class MUST NOT define the finalize method.

Optionally:

  • The class may implement, directly or indirectly, the javax.ejb.MessageDrivenBean interface.

  • The class may implement, directly or indirectly, the javax.ejb.TimedObject interface.

  • The class may implement the ejbCreate method.

The message-driven bean class may have superclasses and/or superinterfaces. If the message-driven bean has superclasses, the methods of the message listener interface, lifecycle callback interceptor methods, the timeout method, the ejbCreate method, and the methods of the MessageDrivenBean interface may be defined in the message-driven bean class or in any of its superclasses. A message-driven bean class MUST NOT have a superclass that is itself a message-driven bean class.

The message-driven bean class is allowed to implement other methods (for example, helper methods invoked internally by the message listener method) in addition to the methods required by the EJB specification.

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine