• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Implementing MessageListener Interface

 
Pearlo Muthukumaran
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic