Basic doubt about JMS under MVC?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   R_Kannan
Posted On:   Monday, April 15, 2002 11:42 PM

Hi, Under MVC Architecture this should be the flow, Jsp-->Controller Servlet-->SessionBean-->Controller Servlet-->Jsp It is known that when a Jsp page is submitted,the control will go to Controller Servlet and the Servlet will redirect the control to some Session Bean ,and Session Bean will return return that processed value back to the controller Servle t . And Servlet will put that value in Session and redirect the control to Jsp .Now Jsp will retreive that value from the session and display it to the user. Fine ,if I want to introduce JMS ,my Controller Servlet will be the message Pr   More>>

Hi,

Under MVC Architecture this should be the flow,

Jsp-->Controller Servlet-->SessionBean-->Controller Servlet-->Jsp

It is known that when a Jsp page is submitted,the control will go to
Controller Servlet and the Servlet will redirect the control to some

Session Bean
,and Session Bean will return return that processed value back
to the controller Servle t . And Servlet will put that value in Session and
redirect the control to Jsp .Now Jsp will retreive that value from the
session and display it to the user.

Fine ,if I want to introduce JMS ,my Controller Servlet will be the message
Producer & Message Consumer for the outgoing request as well as the incomming
processed result .In that case please let me know the flow is correct or not?

Jsp-->Controller Servlet-->Queue-->MDB-->SessionBean-->Queue-->Controller
Servlet-->Jsp


When a Jsp page is submitted, the control will got to
controller
Servlet
and the Servlet will put the request into a Queue .Now a
Message Driven Bean will retreive the request from the Queue and will call
some Session Bean .And Session Bean will put the proceesed result back to
Queue Now the controller Servlet will retreive the result from the
Queue and put in the Session and redirects the controll back to Jsp .Now
Jsp will retreive it from the session and display it to the user.

I have given the flow of two architecture ,my Question is


  1. For this situation is it advisable to proceed with Jms/ without Jms?

  2. If JMS is OK,

    1. the flow which I have predicted is it correct?

    2. Is there any other flow available for better performance?

    3. Is there any other way for the Session Bean to hand over the processed
      result to Servlet without the help of Queue?



  3. If JMS is not OK,

    1. can U suggest me a better situation to implement JMS(offcource it is for
      handling asynchronous situation is known to me,but unable to think of a real
      time simple example) ?

    2. Can U recommend few site which contains simple example for Interprocess
      Communication (I saw Sun tutorial example for Interprocess Communication,but it
      appears to be difficult for a beginner)?





Thanks,

Ranga    <<Less

Re: Basic doubt about JMS under MVC?

Posted By:   Martin_Kernland  
Posted On:   Wednesday, April 17, 2002 04:41 AM

To use JMS or not depends on the application you want to build.
Don't forget that JMS is asynchronous. If you depend on an immediate answer,
you might want to use a synchronous RPC mechanism.

Let's say you are implementing a book order application. The user orders the book
over the web and your servlet would send this order to a JMS queue. Now you can have
multiple order processing nodes picking the orders of the JMS queue (guaranteed only
once delivery (to each node)). Naturally your servlet gives immediately an answer back
to the user, something like "Your order is being processed". When the order is processed
you could send an email to the user. In this example, everything is asynchronous, so JMS
is a perfect choice. (it even scales well!)

But there are many applications where you want to serve the result immediately to the user.
Here JMS is not always the right choice. Try to design a solid use case first and then as a
second step choose the technology.

BTW: If you have many servlets receiving on the same queue the result will only be delivered
to one servlet. You might want to use a topic (publish/subscribe) instead of the second queue
in your design and filter the incoming messages on the servlet side.

good luck!

kerny

Re: Basic doubt about JMS under MVC?

Posted By:   Andreas_Mueller  
Posted On:   Tuesday, April 16, 2002 12:23 PM

Is there any reason why you don't call the session bean directly from your controller servlet?
About | Sitemap | Contact