I am creating a web chat application using JMS and MDB as a Message Listener.
I am sending a TextMessage to a QUEUE from a HttpServlet
I have one Message Driven Bean listening to the Queue.When I send the message MDB automatically recieves the message in onMessage() method and getting printed.. so far good.
BUT now i need to display the message in an
jsp page when ever the onMessage() method triggers.
Here is my MDB Class
package com.chat.mdb;
import java.io.IOException;
import javax.jms.JMSException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
public class ChatBean implements javax.ejb.MessageDrivenBean,
javax.jms.MessageListener {
private javax.ejb.MessageDrivenContext messageContext = null;
public ChatBean() {
}
public void setMessageDrivenContext(
javax.ejb.MessageDrivenContext messageContext)
throws javax.ejb.EJBException {
this.messageContext = messageContext;
}
public void ejbCreate() {
//no specific action required for message-driven beans
}
public void ejbRemove() {
messageContext = null;
}
public void onMessage(javax.jms.Message message) {
System.out.println("Message Driven Bean - Message : \n" + message);
}}
In the above highlighted code i need to take this message to the
servlet
to display the message in jsp.
Any help is appreciated.
Regards,
ved