The docs say "The default queue will call the request handler at the URL 
/worker ..."  So it sounds to me that if you were, for example, using Spring 
MVC, and had a Spring controller with

@Controller
@RequestMapping("/worker")
public final class WorkerController {
    @RequestMapping(method = RequestMethod.GET)
    public String handleGetRequest(final ModelMap model) {
        this.log.debug("called");

        return (null);
    }
}

then it would call your handleGetRequest() method 5 times a second, by sending 
an http GET (or POST?) request to your /worker url each time.

Similarly, with Stripes (and for Struts 2 probably something similar) it would 
be something like

@UrlBinding("/worker")
public class WorkerActionBean implements ActionBean {
    @DefaultHandler
    public Resolution handleRequest() {
        this.log.debug("called");

        return (null);
    }
}

I'm returning null because I don't know what the task queue thing does with 
what it gets back (I didn't read much of their docs; to tell the truth, I 
stopped at that sentence I quoted at the top because it sounds very similar to 
their cron thing, which docs I did read most of).  I'm undoubtedly also lacking 
the code needed to pull the next task off the queue and do something with it.

I'm assuming that you have some web framework in front of everything and thus 
don't need a servlet mapping in your web.xml for the /worker url since the web 
framework is handling the url mapping.

So they're "pinging" your /worker url using a plain old http request to 
initiate running each task; your controller or action bean is what performs the 
task.  Think of it like you typed in your browser's address box 
http://your-gae-app.appspot.com/worker?task_queue_params_go_here or you used 
the command line programs cURL or wget.

If I understand this correctly then I would say that their sentence I quoted 
isn't as clear as it could be.  Given the way it's stated, is the task queue 
really able to bypass all of the http request processing and directly invoke my 
handler method?  How would it know which class+method handles that url?  I 
would think that the servlet container calls the request method, as a result of 
their task queue automaton diddling the url.


John V Denley wrote:
> Yes, I would like a "real" example of how to do this too, I get that
> we need to use a URL to accept the request to do something, but where
> does the URL start executing code. obviously its not going to be at
> the "onModuleLoad" entry point.
> 
> Thanks,
> John
> 
> On Nov 11, 1:23 am, edarroyo <edgardo...@gmail.com> wrote:
>> Is there any gae samples usingtaskqueues that we can look at?
>> I am having a really hard time understanding how to useTaskQueues.
>>
>> Thanks!
>>
>> On Oct 27, 6:18 pm, Vincent <zhou.vi...@gmail.com> wrote:
>>
>>
>>
>>> Thanks , Jason. It's very helpful for me to understand how to use this
>>> new API.
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine-java?hl=en.
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to