Jacek Kwiecień
Jacek Kwiecień

Reputation: 12637

Executing DeferredTask with JAVA GAE sdk

I'm trying to execute delayed DeferredTask in Google App Engine (JAVA).

So far here is what I got.

The task class itself:

public class TestTask implements DeferredTask {


    @Override
    public void run() {
        System.out.print("test");
    }

}

And the execution:

QueueFactory.getDefaultQueue().add(TaskOptions.Builder.withEtaMillis(10000).payload(new TestTask()));

When I run it on the dev server, console output show up right away when task is added to queue, and not after 10 seconds as I wanted :(

Upvotes: 0

Views: 104

Answers (1)

Romin
Romin

Reputation: 8816

The Dev Server typically handles the execution differently. This is detailed in the following section : https://developers.google.com/appengine/docs/java/taskqueue/overview-push#Java_Push_queues_and_the_development_server

So, it is likely that some of the parameters that you are trying to specify are ignored by the dev server and the task is executed immediately. In case you do not want the task to be executed and prefer that you manually invoke it in the dev server, there is a setting to be provided for the app server as detailed in the note above.

Upvotes: 1

Related Questions