Wednesday, July 1, 2009

MDB 3. 0 on Weblogic 10.3 using Oracle AQ ( Advanced Queue)



package testEAR;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import weblogic.javaee.MessageDestinationConfiguration;

@MessageDestinationConfiguration(connectionFactoryJNDIName = "jms.aq.AQFactory")
@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue") },
mappedName = "jms.aq.MY_QUEUE"
)
public class TestMDB implements MessageListener {

public void onMessage(Message message) {
TextMessage txtMsg = null;

txtMsg = (TextMessage) message;
try {
String stringMessage = txtMsg.getText();

System.out.print("Payload: " + stringMessage + "\n");

} catch (JMSException e) {
e.printStackTrace();
}
}
}

No comments:

Post a Comment