How to make asynchronus http request ?

Hi,

In my application I have to send an http post request to another server for some processing. My application crashes if it has to make 100+ requests in a loop based on some business logic. Basically, user is just waiting for the whole processing to be finished before he could do something else. I realize that best option is to put the whole processing in a background job. Now my problem is that I can't figure out a way to do asynchronus http post for sending a request to remote server. Till now I have been using Net:Http post but this is call which is causing the problem. Also can you please suggest as to how can schedule the background job to be fired at particular date/time to make all the asynchronus call in the background.

Any help is greatly appreciated.

Thanks.

Rm Rm wrote:

Any help is greatly appreciated.

Thanks.

check out remote_function(), link_to_remote(), submit_to_remote() for server side async processing.

hth

ilan

I have used these for making ajax call from client side rhtml codes. Can I use these calls from server-side also to make async calls to another domain ?

Ilan Berci wrote:

Rm Rm wrote:

I have used these for making ajax call from client side rhtml codes. Can I use these calls from server-side also to make async calls to another domain ?

Ilan Berci wrote:

Rm Rm wrote:

Any help is greatly appreciated.

Thanks.

check out remote_function(), link_to_remote(), submit_to_remote() for server side async processing.

hth

ilan

No, these methods get translated into javascript callbacks, if you need to it from the server side, then take a look at the gem machanize,on the server, you are totally free to spin off a new thread to make a request anywhere you want..

BackgroundRb is another good option. You can start the request in another thread and monitor it's progress from the controller.