public final void acknowledgeTask(TaskName name, Timestamp scheduleTime) {
    AcknowledgeTaskRequest request =
        AcknowledgeTaskRequest.newBuilder()
            .setName(name == null ? null : name.toString())
            .setScheduleTime(scheduleTime)
            .build();
    acknowledgeTask(request);
  }
Acknowledges a pull task.

<p>The worker, that is, the entity that
[leased][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] this task must call this method to
indicate that the work associated with the task has finished.

<p>The worker must acknowledge a task within the
[lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration] or the lease will
expire and the task will become available to be leased again. After the task is acknowledged,
it will not be returned by a later
[LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks],
[GetTask][google.cloud.tasks.v2beta2.CloudTasks.GetTask], or
[ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks].

<p>Sample code:

<pre>{@code
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
  TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]");
  Timestamp scheduleTime = Timestamp.newBuilder().build();
  cloudTasksClient.acknowledgeTask(name, scheduleTime);
}
}</pre>

@param name Required. The task name. For example:
    `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
@param scheduleTime Required. The task's current schedule time, available in the
    [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by
    [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or
    [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction
    is to ensure that your worker currently holds the lease.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
java-tasks/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2beta2/CloudTasksClient.java