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

查看:27
本文介绍了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 来从任务队列(作为工作人员)进行处理.

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).

我正在寻找两件事:

  1. worker 会是一个 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天全站免登陆