This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet Implementing MessageListener Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Implementing MessageListener Interface" Watch "Servlet Implementing MessageListener Interface" New topic
Author

Servlet Implementing MessageListener Interface

Pearlo Muthukumaran
Ranch Hand

Joined: Sep 17, 2002
Posts: 79
Hi,
I have a requirement wherein
the flow is

HTTP Post <-> Servlet -> JMS Queue A ->|
HTTP Reply /|\ |->Component
|
| |
| |
| V
<--------------- JMS Queue B
To put in short I want to use JMS Synchronously
I understand though IT DEFEATS THE VERY PURPOSE
of JMS But Still...... :-)
I think of two alternatives
1. Create a temporary queue at the servlet and
expect the component to reply to that Queue
2. Make the servlet implement the
MessageListener Interface
I am sure of the first method, but if there are
going to be multiple requests multiple temp queues will be created. But I keep my option
open for this.
I just want to know if the second alternative could be adopted.
What are the implications of Both options?
Thanks in advance for patiently reading and responding... :-)
Regards
Muthu
Pearlo Muthukumaran
Ranch Hand

Joined: Sep 17, 2002
Posts: 79
Hi,
Oops my diagram got messed up.. here it is
HTTP Post <-> Servlet
HTTP Reply / \ |
| |
| V
| JMS Queue A
| |
| |
| V
| Component
| |
| |
| |
| V
JMS Queue B
ie. Servlet becomes a messagelistener
for JMS Queue B
Hope I am clear
Regards
Muthu
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
I don't think it is a good idea to put the message listener methods in a servlet class. Instead - make a "helper" class (probably a Singleton) that can be created when the servlet is init()ed. You will be able to test the message listener outside the servlet environment that way.
Think of the possible confusion with multiple request threads and multiple messages.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Implementing MessageListener Interface
 
Similar Threads
Message Queue in component diagram
MDP consuming from remote JBossMQ Queue
Error : Spring + Jms Application deployed on Oc4j
can MDB used for Topic listening?
JMS persistent messages.