GWT上的Google App Engine任务队列 [英] Google App Engine Task Queue on GWT

查看:100
本文介绍了GWT上的Google App Engine任务队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Google App Engine的Java新任务队列API,我很难将其与我的GWT应用程序相关联。如果我想使用任务队列来执行一些异步处理,我应该怎么做,使用GWT。

I'm looking at Google App Engine's new task queue API for Java and I'm having a hard time relating that to my GWT application. If I wanted to use a task queue to do some asynchronous processing, how should I do that using GWT.

我看到它的方式,我必须发送一个服务器请求,然后将提交到任务队列API。如果我正确理解任务队列,则必须创建另一个servlet,以便从任务队列(作为worker)执行处理。

The way I see it is, I'd have to send a server request that would then do the submission to the task queue API. If I understand task queues properly, I'd have to create yet another servlet to do the processing from the task queue (be the worker).

我在寻找2件事:

I'm looking for 2 things:


  1. 工作者是否是Servlet(即扩展 HttpServlet )?如果没有,有人可以给我一个工作人员的例子吗?

  2. 如果我只是想提交一个异步响应来立即执行,那么使用任务队列真的有意义吗?看来GWT的内置RPC机制已经足够。
  1. Would the worker be a Servlet (i.e. extends HttpServlet)? If not, can someone give me an example of a "worker"?
  2. Does it really make sense to use a task queue if I just want to submit an asynchronous response to be executed immediately? It seems GWT's built-in RPC mechanism is enough.


推荐答案

是的,worker会是可以通过POST参数处理请求的servlet。
如果你想从客户端的角度进行异步调用,那么RPC就足够了(从服务器的角度来看,它仍然是同步的)。如果你想做延迟的工作,而不是与你的客户交谈,你可以使用任务队列。

Yes, worker would be a servlet which can handle a request with POST parameters. If you want an asynchronous call from client's point of view then RPC is enough (from server's point of view it is still synchronous). If you want to do "delayed" jobs which don't talk to your client, you can use a task queue.

这篇关于GWT上的Google App Engine任务队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆