Identify correct and incorrect statements or examples about the interface(s) and methods a JMS Message-Driven bean must implement, and the required metadata.


Required MessageDrivenBean Metadata

A message-driven bean must be annotated with the MessageDriven annotation or denoted in the deployment descriptor as a message-driven bean.

@MessageDriven(activationConfig = { 
		propertyName = "destinationType", 
		propertyValue = "javax.jms.Topic"
public class CalculatorMessagingBean implements MessageListener {
	public void onMessage(Message msg) {


public class CalculatorMessagingBean implements MessageListener {
    public void onMessage(Message msg) {



The Required Message Listener Interface

The message-driven bean class MUST implement the appropriate MESSAGE LISTENER INTERFACE for the messaging type that the message-driven bean supports or specify the message listener interface using the MessageDriven metadata annotation or the messaging-type deployment descriptor element. The specific message listener interface that is implemented by a message-driven bean class distinguishes the messaging type that the message-driven bean supports.

The message-driven bean class's implementation of the javax.jms.MessageListener interface distinguishes the message-driven bean as a JMS message-driven bean.

The bean's message listener method (e.g., onMessage in the case of javax.jms.MessageListener) is called by the container when a message has arrived for the bean to service. The message listener method contains the business logic that handles the processing of the message.

A bean's message listener interface may define more than one message listener method. If the message listener interface contains more than one method, it is the resource adapter that determines which method is invoked.

If the message-driven bean class implements more than one interface other than,, or any of the interfaces defined by the javax.ejb package, the message listener interface must be specified by the messageListenerInterface element of the MessageDriven annotation or the messaging-type element of the message-driven deployment descriptor element.

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