Java Reference
In-Depth Information
for (Timer timer:timers){
sb.append("Time Remaining on timer #" + x );
sb.append(" " + timer.getTimeRemaining());
sb.append(" ");
timerInfo = sb.toString();
return timerInfo;
JMS Alignment
Message-driven beans (MDBs) are Enterprise JavaBeans that are utilized for processing messages in an asynchronous
manner. Most often MDBs are JMS message listeners, receiving messages and processing accordingly. In brief, a
message-driven bean is created by annotating a bean with the @MessageDriven annotation and implementing the
MessageListener interface. When a message is received in the container queue, the container invokes the bean's
onMessage method, which contains the business logic that is responsible for processing the message accordingly.
The following class, org.javaee7.session.AcmeMessageDrivenBean , demonstrates a simple MDB implementation:
@MessageDriven(mappedName = "jms/Queue", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
public class AcmeMessageDrivenBean implements MessageListener {
public AcmeMessageDrivenBean() {
public void onMessage(Message message) {
System.out.println("The following message has been received: " + message);
In this example, when a message is sent to the bean, the onMessage method is invoked, which prints a message
to the system log. As shown in the example, bean providers may provide special configurations for MDBs to the
deployers, such as information regarding message selectors, acknowledgment modes, and so on, by means of
the activationConfig element of the @MessageDriven annotation. The EJB 3.2 release provides a standard list of
activationConfig properties for JMS 2.0 alignment. Table 5-3 describes the new properties.
Search WWH ::

Custom Search