2 Replies Latest reply on Feb 22, 2008 6:29 PM by jnusaira

    Call back from Async Operation

    jnusaira

      Ok. So i asked this question on the other form. And So i have gotten most of the way finished in my solution but the jist is. You have a request from the page making an async call.


      Then page will will every few seconds make an ajax call to the server to see if the request is complete yet.


      And basically the status of its completion (ie: passed, failed, even a message)


      However, my problem is this. When the async request is done, I can't seem to figure out a way for it and the page to be on the same page. Since the async request gets launched in a thread the Session scope is no longer the same one. As far as i can tell they only share the application scope. I tried to be sneaky and pass the Session scope through in a job listener, but that only works the first try. Try it again and their is an error down in a sun library. I could always toss it into a message queue and then check on it but that seems rather wasteful.


      The option i am looking at now is to toss it into a map on the application scope (since i will be using a unique id for the key). But 1) Seems a bit over extending, 2) i'll have to worry about clean up.


      Any thoughts?

        • 1. Re: Call back from Async Operation
          keithnaas

          Would it be possible to use Conversation scope to accomplish this? 


          On a Seam 1.0 app, we implemented a progress bar that simply participated in the conversation.  When the action was finally done, the progress bar would update to 100% and then redisplay the current page.

          • 2. Re: Call back from Async Operation
            jnusaira

            Keith Naas wrote on Feb 22, 2008 05:49 PM:


            Would it be possible to use Conversation scope to accomplish this? 

            On a Seam 1.0 app, we implemented a progress bar that simply participated in the conversation.  When the action was finally done, the progress bar would update to 100% and then redisplay the current page.


            you know i thought about that today. (long running convo i assume you are talking about). I am still not sure since it spans multiple threads how it would handle.


            But it sounds like we were doing the same thing essentially, so i will try it out. Thanks