Search in sources :

Example 1 with AcknowledgeTaskRequest

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()));
}
Also used : AcknowledgeTaskRequest(com.google.api.services.cloudtasks.v2beta2.model.AcknowledgeTaskRequest) CloudTasks(com.google.api.services.cloudtasks.v2beta2.CloudTasks)

Aggregations

CloudTasks (com.google.api.services.cloudtasks.v2beta2.CloudTasks)1 AcknowledgeTaskRequest (com.google.api.services.cloudtasks.v2beta2.model.AcknowledgeTaskRequest)1