Jeremax
Jeremax

Reputation: 41

GAE: Know if a specific task is on the queue

I have to know if a specific task, specific by parameters on the url, is on the queue or not ... should it's possible ?

I'm using Java !

Thanks :)

Upvotes: 3

Views: 372

Answers (2)

Stuart Langley
Stuart Langley

Reputation: 7054

You can probably do this using Named Tasks.

For example, you could hash the task parameters and set the result as the name. Then if you try and insert a task with the same parameters twice the second insertion would fail.

As mentioned before there are race conditions here, you might want to consider if there is a design where having more than once copy of the same task in the queue at any one time is not going to cause problems.

Upvotes: 1

Vishal Biyani
Vishal Biyani

Reputation: 4407

You can use TASK Queue REST API for your checking status of tasks in queue

https://developers.google.com/appengine/docs/java/taskqueue/rest#method_taskqueue_tasks_list

Alternatively you can code for it in advance, use com.google.appengine.api.taskqueue.TaskHandle class to get an handle on the task, and then expose the object through a API

Upvotes: 0

Related Questions