Click to See Complete Forum and Search --> : Queue requests in ASP


baconbutty
08-11-2004, 10:07 AM
I am writing a simple ASP page, that allows several people to update a flat XML text file.

I.e. for each update, the XML file is loaded, the change applied, and the XML file is saved again, at the server.

Is there any way to set up an ASP site so that several updates can be queued, and applied when all others in the queue have been applied? Or is this a silly question.

I am not expecting a complete solution; at best just pointers to sources of information if any.

I know that I can achieve most of this by simply using the Application object to block more than one update at a time, but what I would like to achieve is that if an update is blocked, rather than the user having to resend, the update is stored by the server, and automatically retried periodically until successful or timeout.

I also know all this is not very elegant, and if I used database technology all this would be handled by the database.

CardboardHammer
08-11-2004, 04:14 PM
It can be done, but you'd be better off using a database.

One way to do it without a database: In the Application object, store update_num. When an update comes in, get update_num from Application and then increment its value in Application. Save the update to a file having the name of update_num in a directory for such updates. Run a process on the webserver that: checks for update files; while any exist, processes them from lowest number to highest number, deleting the file after it is processed; goes to sleep for a length of time when there are no files to process.

baconbutty
08-12-2004, 02:33 AM
Thank you very much for your your suggestion. I will look into it.

The alternative I came up with was to simply have a process running in the client that kept retrying using the HTTP Request Object.

But I take your point. On reflection I think I must seize the nettle and use a database.