As Fabrizio has mentioned, the API methods have changed.  However,
you're saying that you can get the code to compile and it's throwing
errors at runtime, which suggests that something has gone wrong with
your imports - are you including both the labs and the non-labs API
imports in the same class?

Simon

On Jan 23, 6:14 pm, Doug <[email protected]> wrote:
> Good Afternoon All,
>
>  I am working to convert from the Task Queue Labs API to the non-labs API
> version.  I am finding it slightly more difficult than I initially
> anticipated.  It appears that how I was adding tasks to the queue is not
> compatible with the non-labs API.  If I just update the imports to bring in
> the new API I get the error “The method url(String) is undefined for the
> type TaskOptions.Builder”.  I  have provide some example of my code below,
> if anyone else has converted can you give me some guidance on what I am
> doing wrong?
>
> Current code, using the Labs API:
> *import* *com.google.appengine.api.labs.taskqueue.Queue*;
> *import* *com.google.appengine.api.labs.taskqueue.QueueFactory*;
> *import* *com.google.appengine.api.labs.taskqueue.TaskOptions*;
> *import* *com.google.appengine.api.labs.taskqueue.TaskOptions.Method*;
> *import* *com.google.appengine.api.labs.taskqueue.TaskOptions.Builder*.*;
>
> …
>
> Queue add_queue = QueueFactory.getQueue("add");
> …
>
> for (int i = 1; i < Item_counter; i++) {
>
> add_queue.add(TaskOptions.Builder.url("/add?item="+ItemURL[i]).method(Method.GET));
>
> }
>
> Code using the non-Labs API
>
> import com.google.appengine.api.taskqueue.Queue;
> import com.google.appengine.api.taskqueue.QueueFactory;
> import com.google.appengine.api.taskqueue.TaskOptions;
> import com.google.appengine.api.taskqueue.TaskOptions.Method;
> import static com.google.appengine.api.taskqueue.TaskOptions.Builder.*;
>
> TaskOptions TOdefault =
> com.google.appengine.api.taskqueue.TaskOptions.Builder.withDefaults();
>
> …
>
> for (int i = 1; i < Item_counter; i++) {
>
> TaskOptions TO = new TaskOptions(TOdefault);
>             TO.url("/add");
>             TO.param("item", itemURL[i]);
>             TO.method(Method.GET);
>             add_queue.add(TO);
>
> }
>
> The new code compiles and will “run”, but I get all kinds of null pointer
> exceptions from the tasks when they try to run.  If I switch back to the
> labs API it works perfectly.  Can anyone help me understand what I need to
> do to either get my original code to work with the new API and/or what I did
> incorrectly with the updated code?
>
> Thanks,
> Doug

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to