use of com.google.api.services.cloudtasks.v2beta2.model.AcknowledgeTaskRequest in project java-docs-samples by GoogleCloudPlatform.
the class PullQueue method acknowledgeTask.
/**
* Acknowledge a given task, which removes it from the queue.
*/
private static void acknowledgeTask(Task task) throws IOException {
// Create the Cloud Tasks Client
CloudTasks client = createAuthorizedClient();
// Create the AcknowledgeTaskRequest
AcknowledgeTaskRequest request = new AcknowledgeTaskRequest().setScheduleTime(task.getScheduleTime());
// Execute the request
client.projects().locations().queues().tasks().acknowledge(task.getName(), request).execute();
System.out.println(String.format("Acknowledged task %s", task.getName()));
}
Aggregations