我怎样才能让网络应用程序连续轮询队列?还是必须是另一项服务?

时间:2022-02-04 02:12:09

If I use a queue in my web application (spring), can I do:

如果我在我的Web应用程序(spring)中使用队列,我可以这样做:

while(..)
{

}

To response to new items added to a queue, or does this have to be a seperate service that runs on the server?

要响应添加到队列中的新项目,还是必须是在服务器上运行的单独服务?

i.e. this can't be sustained in a web application correct?

即这在Web应用程序中无法维持正确吗?

1 个解决方案

#1


0  

You would want your web app to use timers to periodically wake up and poll the server (for example, using an AJAX request if the request is made all the way from the browser).

您希望您的Web应用程序使用计时器定期唤醒并轮询服务器(例如,如果请求是从浏览器一直进行的,则使用AJAX请求)。

#1


0  

You would want your web app to use timers to periodically wake up and poll the server (for example, using an AJAX request if the request is made all the way from the browser).

您希望您的Web应用程序使用计时器定期唤醒并轮询服务器(例如,如果请求是从浏览器一直进行的,则使用AJAX请求)。