transactional tasks

60 views
Skip to first unread message

Trez Ertzzer

unread,
Nov 6, 2015, 6:06:28 AM11/6/15
to Google App Engine
hello.
I have a question concerning transactional tasks.
it's written in the documenation "Transactional tasks must not have user-specified names"
(see https://cloud.google.com/appengine/docs/java/taskqueue/#Java_Tasks_within_transactions)
(https://cloud.google.com/appengine/docs/java/datastore/transactions#Java_Transactional_task_enqueuing)

my question is: when I do

DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
Queue queue = QueueFactory.getDefaultQueue();
try {
   
Transaction txn = ds.beginTransaction();

   
// ...

   
TaskHandle taskHandle = queue.add(TaskOptions.Builder.withUrl("/path/to/my/worker").countdownMillis(10000));

taskHandle.getName()
;
   
// ...
    txn
.commit();
} catch (DatastoreFailureException e) {
}


does the "taskHandle.getName();" return something in this exemple?
if not how is it possible to later delete the task from the queue? (if the task has not yet been executed?)
thank you.

Patrice (Cloud Platform Support)

unread,
Nov 6, 2015, 10:41:10 AM11/6/15
to Google App Engine
Hi,

From the javadoc reference here, it says that if you don't generate the name, the queue.add call will generate one. You can see here as well that the name can be auto-generated :).

Cheers!
Reply all
Reply to author
Forward
0 new messages