Home Javacertification Bcd-guide From a list, identify the responsibility of the bean provider and the responsibility of the container provider for a message-driven bean.

Ask Questions?

View Latest Questions

Advertisement


 
 

From a list, identify the responsibility of the bean provider and the responsibility of the container provider for a message-driven bean.
Posted on: April 18, 2011 at 12:00 AM
This page discusses - From a list, identify the responsibility of the bean provider and the responsibility of the container provider for a message-driven bean.

From a list, identify the responsibility of the bean provider and the responsibility of the container provider for a message-driven bean.

Bean Provider responsibility

The message-driven bean provider is responsible for providing message-driven bean class. The following are the requirements for the message-driven bean class:

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

  • The class MUST implement, directly or indirectly, the javax.jms.MessageListener interface.

  • The class MUST be defined as public, MUST NOT be final, and MUST NOT be abstract.

  • 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.

  • The class MUST implement the ejbCreate() method (it can be empty).

  • The message-driven bean class may have superclasses and/or superinterfaces. If the message-driven bean has superclasses, the ejbCreate method, and the methods of the MessageDrivenBean and MessageListener interfaces may be defined in the message-driven bean class or in any of its superclasses.

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

The message-driven bean class MUST define ONE ejbCreate() method whose signature must follow these rules:

  • The method name MUST be ejbCreate.

  • The method MUST be declared as public.

  • The method MUST NOT be declared as final or static.

  • The return type MUST be void.

  • The method MUST HAVE NO arguments.

  • The throws clause MUST NOT define any APPLICATION exceptions.

The message-driven bean class MUST define ONE onMessage method whose signature must follow these rules:

  • The method MUST be declared as public.

  • The method MUST NOT be declared as final or static.

  • The return type MUST be void.

  • The method MUST HAVE a single argument of type javax.jms.Message.

  • The throws clause MUST NOT define any APPLICATION exceptions.

The message-driven bean class MUST define ONE ejbRemove() method whose signature must follow these rules:

  • The method name MUST be ejbRemove.

  • The method MUST be declared as public.

  • The method MUST NOT be declared as final or static.

  • The return type MUST be void.

  • The method MUST HAVE NO arguments.

  • The throws clause MUST NOT define any APPLICATION exceptions.

Container Provider responsibility

The container provider must support the deployment of a message-driven bean as the consumer of a JMS queue or a durable subscription.

The container must ensure that ONLY ONE thread can be executing an instance at any time.

The container must follow the rules with respect to transaction scoping, security checking, and exception handling.

Visit http://java.boot.by  for the updates.

Advertisement


DMCA.com