Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to sent the MDB onMessage() method's message to HttpServlet

843830Jan 19 2007 — edited Sep 26 2008
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,
Altosys Java Team

Message was edited by:
Altosys
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2008
Added on Jan 19 2007
4 comments
273 views