views:

386

answers:

1

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.

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

I'm looking for 2 things:

  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.
+2  A: 

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.

Dmitry
Great, thanks. Good point about the tasks. Instead of trying to create a thread (which is impossible in App Engine), this is a great way to asynchronously run tasks.
Nick