Monday, March 26, 2012

Design Question (Looking for your opinions)

I have a page that I need to call a method from my business tier. This method ussually will execute and complete quite quickly.

But because we are making and call to an external service. There are times where the network could be slow or the request gets sent but nothing comes back.

What I want to do is use ajax to make a call to the Business Layer. If it takes longer than say 5 secs. I want the ajax call to timeout and redirect to another page. Leaving

the process to complete on it's own (It doesn't return anything). The status of the "Async Job" will be checked somewhere else by the user.

Would this be an exceptable means of dealing with a long running task? We don't need the user to wait until it's complete.

Check out this for one example on long running queries...

http://www.west-wind.com/atlas/LongProgress/LongProgress.aspx

Maynot be exactly what you are looking for but...


That's a great example. Thank you very much.. I got it working :)

If I make the async call time out and call the function like so onTimeOut fires properly. If an error happens it goes to this method as well.

PageMethods.SendInfo(onComplete,onTimeOut);

If I make the async call error out OR time out and call the function like so PageMethods.SendInfo(onComplete,OnError,onTimeOut); both

timeouts & errors got the onError method.

No comments:

Post a Comment