Which two statements are true JMS message-driven beans?

Which two statements are true JMS message-driven beans? (Choose two.)

Which two statements are true JMS message-driven beans? (Choose two.)

A.
The developer can use JMS message selector declarations to restrict the message that the
bean receives.

B.
The developer can associate the bean with a specific queue or topic using the resource-ref
element of the deployment descriptor.

C.
To achieve concurrent processing of more than one message at a time, more than one bean
class must be associated with the same JMS queue.

D.
The developer can use the activationConfig element of the MessageDriven annotation to
specify whether the bean should be associated with a queue or a topic.

Explanation:
A:Elements in the deployment descriptor
The description of a MDB(message-driven beans)in the EJB 2.0 deployment descriptor contains
the following specific elements:
*the JMS acknowledgement mode: auto-acknowledge or dups-ok-acknowledge
*an eventual JMS message selector: this is a JMS concept which allows the filtering of the
messages sent to the destination
*a message-driven-destination, which contains the destination type (Queue or Topic) and the
subscription
D:Example:
The following example is a basic message-driven bean:
@MessageDriven(activationConfig={
@ActivationConfigProperty(propertyName=”destination”, propertyValue=”myDestination”),
@ActivationConfigProperty(propertyName=”destinationType”, propertyValue=”javax.jms.Queue”)
})
public class MsgBean implements javax.jms.MessageListener {
public void onMessage(javax.jms.Message msg) {
String receivedMsg = ((TextMessage) msg).getText();
System.out.println(“Received message: ” + receivedMsg);
}

}
Reference:Developing message-driven beans
Reference:Message Driven Beans Tutorial



Leave a Reply 0

Your email address will not be published. Required fields are marked *