Search in sources :

Example 1 with UpdateQueueRequest

use of com.google.cloud.tasks.v2.UpdateQueueRequest in project java-docs-samples by GoogleCloudPlatform.

the class UpdateQueue method updateQueue.

public static void updateQueue(String projectId, String locationId, String queueId) throws Exception {
    try (CloudTasksClient client = CloudTasksClient.create()) {
        // TODO(developer): Uncomment these lines and replace with your values.
        // String projectId = "your-project-id";
        // String locationId = "us-central1";
        // String queueId = "queue-blue";
        LocationName parent = LocationName.of(projectId, locationId);
        Queue queueBlue = Queue.newBuilder().setName(QueueName.of(projectId, locationId, queueId).toString()).setRateLimits(RateLimits.newBuilder().setMaxDispatchesPerSecond(20.0).setMaxConcurrentDispatches(10)).build();
        UpdateQueueRequest request = UpdateQueueRequest.newBuilder().setQueue(queueBlue).build();
        Queue response = client.updateQueue(request);
        System.out.println(response);
    }
}
Also used : CloudTasksClient(com.google.cloud.tasks.v2.CloudTasksClient) Queue(com.google.cloud.tasks.v2.Queue) UpdateQueueRequest(com.google.cloud.tasks.v2.UpdateQueueRequest) LocationName(com.google.cloud.tasks.v2.LocationName)

Aggregations

CloudTasksClient (com.google.cloud.tasks.v2.CloudTasksClient)1 LocationName (com.google.cloud.tasks.v2.LocationName)1 Queue (com.google.cloud.tasks.v2.Queue)1 UpdateQueueRequest (com.google.cloud.tasks.v2.UpdateQueueRequest)1