Posted By:
karuna
Posted On:
Tuesday, March 5, 2013 08:16 AM
I have a jms queue(myQueue) that has some messages. I have created a message driven bean(MDB) to read message from that queue. But looks like my mdb is not triggered even though messages are present in the queue. I am using qbrowser to verify if messages are present or not in the queue. Also, I am not getting any exception when I deployed the mdb. I used the documentation at http://docs.oracle.com/cd/E19798-01/821-1841/bnbpk/index.html to create this mdb. Here is my code: Queue name is myQueue. I dont understand why this mdb is not getting triggered. What are the possible causes ? I am not getting any exception also. help appreciated. thanks. @MessageDriven(mappedName = "jms/my
More>>
I have a jms queue(myQueue) that has some messages. I have created a message driven bean(MDB) to read message from that queue. But looks like my mdb is not triggered even though messages are present in the queue. I am using qbrowser to verify if messages are present or not in the queue. Also, I am not getting any exception when I deployed the mdb. I used the documentation at
http://docs.oracle.com/cd/E19798-01/821-1841/bnbpk/index.html
to create this mdb.
Here is my code: Queue name is myQueue. I dont understand why this mdb is not getting triggered. What are the possible causes ? I am not getting any exception also. help appreciated. thanks.
@MessageDriven(mappedName = "jms/myQueue")
public class NewMessageBean1 implements MessageListener {
@Resource
private MessageDrivenContext mdc;
public void onMessage(Message inMessage) {
System.out.println("onMessage");
TextMessage msg = null;
try {
if (inMessage instanceof TextMessage) {
msg = (TextMessage) inMessage;
System.out.println("MESSAGE BEAN: Message received: " +
msg.getText());
} else {
System.out.println("Message of wrong type: " +
inMessage.getClass().getName());
}
} catch (JMSException e) {
e.printStackTrace();
mdc.setRollbackOnly();
} catch (Throwable te) {
te.printStackTrace();
}
}
}
<<Less