}
URL uri = new URL(url);
String path = uri.getPath();
Queue queue = QueueFactory.getDefaultQueue();
TaskHandle task = queue.add(withUrl(path)
.payload(request.toString())
.countdownMillis(delay));
// store task information
DateTime timestamp = DateTime.now().plus(delay);
GaeTask storedTask = new GaeTask(task.getName(),
agentId, timestamp.toString());
ObjectDatastore datastore = new AnnotationObjectDatastore();
datastore.store(storedTask);
return task.getName();
} catch (MalformedURLException e) {
e.printStackTrace();
}
// TODO: throw error?