Class AbstractMessageDrivenBean

All Implemented Interfaces:
javax.ejb.EnterpriseBean, javax.ejb.MessageDrivenBean,
Direct Known Subclasses:

public abstract class AbstractMessageDrivenBean
extends AbstractEnterpriseBean
implements javax.ejb.MessageDrivenBean

Convenient superclass for MDBs. Doesn't require JMS, as EJB 2.1 MDBs are no longer JMS-specific: see the AbstractJmsMessageDrivenBean subclass.
This class ensures that subclasses have access to the MessageDrivenContext provided by the EJB container, and implement a no argument ejbCreate() method as required by the EJB specification, but not the javax.ejb.MessageDrivenBean interface.
NB: we cannot use final methods to implement EJB API methods, as this violates the EJB specification.

Rod Johnson
See Also:
Serialized Form

Fields inherited from class
Constructor Summary
Method Summary
abstract  void ejbCreate()
          Lifecycle method required by the EJB specification but not the MessageDrivenBean interface.
 void ejbRemove()
          This method is required by the EJB Specification.
protected  javax.ejb.MessageDrivenContext getMessageDrivenContext()
          Convenience method for subclasses to use
 void setMessageDrivenContext(javax.ejb.MessageDrivenContext messageDrivenContext)
          Required lifecycle method.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public AbstractMessageDrivenBean()
Method Detail


protected final javax.ejb.MessageDrivenContext getMessageDrivenContext()
Convenience method for subclasses to use
the MessageDrivenContext passed to this EJB by the EJB container


public void setMessageDrivenContext(javax.ejb.MessageDrivenContext messageDrivenContext)
Required lifecycle method. Sets the MessageDriven context.
Specified by:
setMessageDrivenContext in interface javax.ejb.MessageDrivenBean
messageDrivenContext - MessageDrivenContext


public abstract void ejbCreate()
Lifecycle method required by the EJB specification but not the MessageDrivenBean interface. We implement this as an abstract method to force subclasses to implement it. Can use BeanFactory here for initialization if required.


public void ejbRemove()
This method is required by the EJB Specification.
Specified by:
ejbRemove in interface javax.ejb.MessageDrivenBean

Rod Johnson and Spring contributors 2001-2003.