这是问题所在: 有经典的asp应用程序,它调用lame.exe来编码mp3,每天都有很多时间 并且无法控制从另一个单词中的多个用户调用lame.exe的方式,没有用于此目的的队列。 所以这就是我在想的:
//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
所以我只想知道有没有更好的解决方案? 还是其他任何方法?
问候。
答案 0 :(得分:1)
看起来像经典asp的合理方法。
只需确保在checkQ
函数中,您只检索process_flag
设置为undone
的队列项,或者您可能尝试重新处理相同的项一遍又一遍。
阅读this文章,了解使用MSMQ的另一种方法 - 首先创建一个新的公共队列,然后从您的asp页面向其发送消息。它还需要一个额外的可执行文件来处理排队的项目。
答案 1 :(得分:1)
这是MSMQ的完美应用。让经验证的代码处理可靠的消息传递,并发控制等等,这样您就可以专注于应用程序逻辑。