tags:

views:

25

answers:

2

Hi,

here is the problem : there is classic asp app which is calling lame.exe for encoding mp3s for lots of time per day and there is no control of the way of calling lame.exe from several users in another word there is no queue for that purpose. so here is what I am thinking about :

//below code all are pseudo-code
//process_flag and mp3 and processId all are reside in a database

function addQ(string mp3)
add a record to database 
and set process_flag to undone
then goto checkQ
end function

function checkQ()
if there is a process in queue list and process_flag is undone
sort in by processID asc
for each processID
    processQ(processID)
end for
end function

function ProcessQ(int processID)
run lame.exe with the help of wscript.exe
after doing the job set the process_flag to done
end function

so I just want to know is there any better solution? or any other approaches out there?

regards.

+1  A: 

Looks like a reasonable approach for classic asp.

Just make sure that in your checkQ function, you are only retrieving queue items that have the process_flag set to undone, or you might be trying to re-process the same items over and over.

Read this article for another approach using MSMQ - it starts by creating a new Public Queue, then sending messages to it from your asp page. It also required an additional executable to process queued items.

Oded
oh I forgot to add that actually yes its like that,but I am still waiting for other approaches I mean approaches that do this task better than me.regards.
austin powers
@austin powers - Yes, I understood that. I think your approach is fine.
Oded
+1  A: 

This is a perfect application for MSMQ. Let proven code handle the reliable messaging, concurrency control etc. so you can just focus on the application logic.

Tom Cabanski