Reputation: 189
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.
Upvotes: 3
Views: 844
Reputation: 1
Check your imports. You may be importing the incorrect Queue class.
If your Queue is imported via
import com.google.appengine.api.labs.taskqueue.Queue;
then queue.add(TaskOptions.Builder.url(""))
method exists.
If your Queue is imported via
import com.google.appengine.api.taskqueue.Queue;
then will you will receive the error.
Upvotes: 0
Reputation: 29629
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"));
Upvotes: 3