2 Replies Latest reply on Jun 4, 2010 6:26 PM by shravanou

    SEAM Long Running Conversation

      We have a scenario where we give the details like from/ to date, select report ... and after clicking on submit; the page process the request, a long conversation which runs for 2 minutes and in the mean while if the user clicks on any other links in the application he needs to be taken to the requested page.


         This is not really happening in our application quite well. Can any of the seam pundits help me here.


      Thanks!
      Kumar

        • 1. Re: SEAM Long Running Conversation
          kragoth

          Ok, take away Seam for the moment because your problem has nothing to do with Seam. This is a fundamental issue with any web based application. You are in the land of html and thus must follow it's rules. (Well, these rules can be bent a bit :P)


          (Simplified version here, go read more on the topic to get an explanation of all the details)
          When a user clicks a link they do one of two things they either request a resource from the server with GET or they POST data to the server and wait for a response. If another operation(POST/GET) happens while waiting for the response then the response for that POST operation will be thrown away as it is considered to be older then the new operation.


          So, from a pure html perspective what you want to do is not possible. But, we all LOVE impossible don't we. :)


          So, your problem has been solved by thousands of people and in probably hundreds of different ways. But, I will give you the rough idea and you can research which way you will implement it. (This forum contains quite a number of topics on how to do it if you spend some time searching :) )


          What you want to do is this.


          When the user clicks the button to generate the report you want to queue up the report to be created in some form of schedule/asynchronous call. So currently you have a button with something like action='#{MySeamBean.generateReport()}' This method goes off and actually generates the report. Instead of doing that you'll have some sort of asych way of doing your report and all your generateReport() method will do is call the asynch method (with appropriate params) and return.


          Now obviously more work needs to be done. Because if you generate the report asychronously how do you get it to your user! The way you do this is entirely up to you. You can email it to them, you can save it to the database and provide a way for your users to see the reports that are saved in the database or come up with your own cool way of telling the user that the report they requested has been generated and is ready for them to view.


          So, how you implement this will be up to you. The application I'm working on uses a background polling mechanism. So we add a request to generate a report along with all its params on a table and the poller will pick it up and go generate it. Then it will email the user the report.


          Anyway I hope this helps you get on the right track to solving your problem :)


          • 2. Re: SEAM Long Running Conversation

            Thank You Tim for the clear explanation. Right now we are just doing in this way. Will get back to you if I have any more questions