Message Driven Bean Class in Java

Chapter 4 - EJB 3.0 Message-Driven Bean Component Contract

    Message Driven Bean Class in Java

  • The requirements for the message-driven bean class:

                   •  The class implement, directly or indirectly, the message listener interface required by the messaging type that it supports or the methods of the message listener interface.JMS 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 cannot 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 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 then it is itself a message-driven bean class.

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

© 2015 by Learncertification All Rights Reserved. The certification names are the trademarks of their respective owners. Terms & Privacy Policy