1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.ejb;
  6. /**
  7. * The MessageDrivenBean interface is implemented by every message-driven
  8. * enterprise Bean class. The container uses the MessageDrivenBean methods
  9. * to notify the enterprise Bean instances of the instance's life cycle
  10. * events.
  11. */
  12. public interface MessageDrivenBean extends EnterpriseBean {
  13. /**
  14. * Set the associated message-driven context. The container calls
  15. * this method after the instance creation.
  16. *
  17. * <p> The enterprise Bean instance should store the reference to the
  18. * context object in an instance variable.
  19. *
  20. * <p> This method is called with no transaction context.
  21. *
  22. * @param ctx A MessageDrivenContext interface for the instance.
  23. *
  24. * @exception EJBException Thrown by the method to indicate a failure
  25. * caused by a system-level error.
  26. *
  27. */
  28. void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException;
  29. /**
  30. * A container invokes this method before it ends the life of the
  31. * message-driven object. This happens when a container decides to
  32. * terminate the message-driven object.
  33. *
  34. * <p> This method is called with no transaction context.
  35. *
  36. * @exception EJBException Thrown by the method to indicate a failure
  37. * caused by a system-level error.
  38. *
  39. */
  40. void ejbRemove() throws EJBException;
  41. }