views:

83

answers:

1
+2  Q: 

Task queue java

Hi i'm new to Task queue concepts when i referred the guide I got struck on this line

queue.add(
      DatastoreServiceFactory.getDatastoreService().getCurrentTransaction(),
      TaskOptions().url("/path/to/my/worker")); 

what is TaskOptions() method. Is it default method are method created manually what will TaskOptions() method will return.

I created a method called TaskOption() when i to return a string value its saying error as "The method url(String) is undefined for the type String"

In url what i want to specify servlet are any other.

My doubt may be stupid but please clarify it.

Thank you, sharun.

+3  A: 

It looks like a bug in the doco to me. My guess is what they meant was to use TaskOptions.Builder which is a class full of static methods to make it easy to create TaskOptions. So the code example should probably look like this:

queue.add(
     DatastoreServiceFactory.getDatastoreService().getCurrentTransaction(),
     TaskOptions.Builder.url("/path/to/my/worker")); 
krock