Package com.google.cloud.tasks.v2beta2 (2.3.0)

The interfaces provided are listed below, along with usage samples.

CloudTasksClient

Service Description: Cloud Tasks allows developers to manage the execution of background work in their applications.

Sample for CloudTasksClient:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
   QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
   Queue response = cloudTasksClient.getQueue(name);
 }
 

Classes

AcknowledgeTaskRequest

Request message for acknowledging a task using AcknowledgeTask.

Protobuf type google.cloud.tasks.v2beta2.AcknowledgeTaskRequest

AcknowledgeTaskRequest.Builder

Request message for acknowledging a task using AcknowledgeTask.

Protobuf type google.cloud.tasks.v2beta2.AcknowledgeTaskRequest

AppEngineHttpRequest

App Engine HTTP request. The message defines the HTTP request that is sent to an App Engine app when the task is dispatched. This proto can only be used for tasks in a queue which has app_engine_http_target set. Using AppEngineHttpRequest requires appengine.applications.get Google IAM permission for the project and the following scope: https://www.googleapis.com/auth/cloud-platform The task will be delivered to the App Engine app which belongs to the same project as the queue. For more information, see How Requests are Routed and how routing is affected by dispatch files. Traffic is encrypted during transport and never leaves Google datacenters. Because this traffic is carried over a communication mechanism internal to Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). The request to the handler, however, will appear to have used the HTTP protocol. The AppEngineRouting used to construct the URL that the task is delivered to can be set at the queue-level or task-level:

  • If set, app_engine_routing_override is used for all tasks in the queue, no matter what the setting is for the task-level app_engine_routing. The url that the task will be sent to is:
  • url = host + relative_url Tasks can be dispatched to secure app handlers, unsecure app handlers, and URIs restricted with login: admin. Because tasks are not run as any user, they cannot be dispatched to URIs restricted with login: required Task dispatches also do not follow redirects. The task attempt has succeeded if the app's request handler returns an HTTP response code in the range [200 - 299]. The task attempt has failed if the app's handler returns a non-2xx response code or Cloud Tasks does not receive response before the deadline. Failed tasks will be retried according to the retry configuration. 503 (Service Unavailable) is considered an App Engine system error instead of an application error and will cause Cloud Tasks' traffic congestion control to temporarily throttle the queue's dispatches. Unlike other types of task targets, a 429 (Too Many Requests) response from an app handler does not cause traffic congestion control to throttle the queue.

Protobuf type google.cloud.tasks.v2beta2.AppEngineHttpRequest

AppEngineHttpRequest.Builder

App Engine HTTP request. The message defines the HTTP request that is sent to an App Engine app when the task is dispatched. This proto can only be used for tasks in a queue which has app_engine_http_target set. Using AppEngineHttpRequest requires appengine.applications.get Google IAM permission for the project and the following scope: https://www.googleapis.com/auth/cloud-platform The task will be delivered to the App Engine app which belongs to the same project as the queue. For more information, see How Requests are Routed and how routing is affected by dispatch files. Traffic is encrypted during transport and never leaves Google datacenters. Because this traffic is carried over a communication mechanism internal to Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). The request to the handler, however, will appear to have used the HTTP protocol. The AppEngineRouting used to construct the URL that the task is delivered to can be set at the queue-level or task-level:

  • If set, app_engine_routing_override is used for all tasks in the queue, no matter what the setting is for the task-level app_engine_routing. The url that the task will be sent to is:
  • url = host + relative_url Tasks can be dispatched to secure app handlers, unsecure app handlers, and URIs restricted with login: admin. Because tasks are not run as any user, they cannot be dispatched to URIs restricted with login: required Task dispatches also do not follow redirects. The task attempt has succeeded if the app's request handler returns an HTTP response code in the range [200 - 299]. The task attempt has failed if the app's handler returns a non-2xx response code or Cloud Tasks does not receive response before the deadline. Failed tasks will be retried according to the retry configuration. 503 (Service Unavailable) is considered an App Engine system error instead of an application error and will cause Cloud Tasks' traffic congestion control to temporarily throttle the queue's dispatches. Unlike other types of task targets, a 429 (Too Many Requests) response from an app handler does not cause traffic congestion control to throttle the queue.

Protobuf type google.cloud.tasks.v2beta2.AppEngineHttpRequest

AppEngineHttpTarget

App Engine HTTP target. The task will be delivered to the App Engine application hostname specified by its AppEngineHttpTarget and AppEngineHttpRequest. The documentation for AppEngineHttpRequest explains how the task's host URL is constructed. Using AppEngineHttpTarget requires appengine.applications.get Google IAM permission for the project and the following scope: https://www.googleapis.com/auth/cloud-platform

Protobuf type google.cloud.tasks.v2beta2.AppEngineHttpTarget

AppEngineHttpTarget.Builder

App Engine HTTP target. The task will be delivered to the App Engine application hostname specified by its AppEngineHttpTarget and AppEngineHttpRequest. The documentation for AppEngineHttpRequest explains how the task's host URL is constructed. Using AppEngineHttpTarget requires appengine.applications.get Google IAM permission for the project and the following scope: https://www.googleapis.com/auth/cloud-platform

Protobuf type google.cloud.tasks.v2beta2.AppEngineHttpTarget

AppEngineRouting

App Engine Routing. Defines routing characteristics specific to App Engine - service, version, and instance. For more information about services, versions, and instances see An Overview of App Engine, Microservices Architecture on Google App Engine, App Engine Standard request routing, and App Engine Flex request routing.

Protobuf type google.cloud.tasks.v2beta2.AppEngineRouting

AppEngineRouting.Builder

App Engine Routing. Defines routing characteristics specific to App Engine - service, version, and instance. For more information about services, versions, and instances see An Overview of App Engine, Microservices Architecture on Google App Engine, App Engine Standard request routing, and App Engine Flex request routing.

Protobuf type google.cloud.tasks.v2beta2.AppEngineRouting

AttemptStatus

The status of a task attempt.

Protobuf type google.cloud.tasks.v2beta2.AttemptStatus

AttemptStatus.Builder

The status of a task attempt.

Protobuf type google.cloud.tasks.v2beta2.AttemptStatus

CancelLeaseRequest

Request message for canceling a lease using CancelLease.

Protobuf type google.cloud.tasks.v2beta2.CancelLeaseRequest

CancelLeaseRequest.Builder

Request message for canceling a lease using CancelLease.

Protobuf type google.cloud.tasks.v2beta2.CancelLeaseRequest

CloudTasksClient

Service Description: Cloud Tasks allows developers to manage the execution of background work in their applications.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
   QueueName name = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
   Queue response = cloudTasksClient.getQueue(name);
 }
 

Note: close() needs to be called on the CloudTasksClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of CloudTasksSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 CloudTasksSettings cloudTasksSettings =
     CloudTasksSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 CloudTasksSettings cloudTasksSettings =
     CloudTasksSettings.newBuilder().setEndpoint(myEndpoint).build();
 CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 CloudTasksSettings cloudTasksSettings =
     CloudTasksSettings.newBuilder()
         .setTransportChannelProvider(
             CloudTasksSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

CloudTasksClient.ListQueuesFixedSizeCollection

CloudTasksClient.ListQueuesPage

CloudTasksClient.ListQueuesPagedResponse

CloudTasksClient.ListTasksFixedSizeCollection

CloudTasksClient.ListTasksPage

CloudTasksClient.ListTasksPagedResponse

CloudTasksGrpc

Cloud Tasks allows developers to manage the execution of background work in their applications.

CloudTasksGrpc.CloudTasksBlockingStub

Cloud Tasks allows developers to manage the execution of background work in their applications.

CloudTasksGrpc.CloudTasksFutureStub

Cloud Tasks allows developers to manage the execution of background work in their applications.

CloudTasksGrpc.CloudTasksImplBase

Cloud Tasks allows developers to manage the execution of background work in their applications.

CloudTasksGrpc.CloudTasksStub

Cloud Tasks allows developers to manage the execution of background work in their applications.

CloudTasksProto

CloudTasksSettings

Settings class to configure an instance of CloudTasksClient.

The default instance has everything set to sensible defaults:

  • The default service address (cloudtasks.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getQueue to 30 seconds:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 CloudTasksSettings.Builder cloudTasksSettingsBuilder = CloudTasksSettings.newBuilder();
 cloudTasksSettingsBuilder
     .getQueueSettings()
     .setRetrySettings(
         cloudTasksSettingsBuilder
             .getQueueSettings()
             .getRetrySettings()
             .toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 CloudTasksSettings cloudTasksSettings = cloudTasksSettingsBuilder.build();
 

CloudTasksSettings.Builder

Builder for CloudTasksSettings.

CreateQueueRequest

Request message for CreateQueue.

Protobuf type google.cloud.tasks.v2beta2.CreateQueueRequest

CreateQueueRequest.Builder

Request message for CreateQueue.

Protobuf type google.cloud.tasks.v2beta2.CreateQueueRequest

CreateTaskRequest

Request message for CreateTask.

Protobuf type google.cloud.tasks.v2beta2.CreateTaskRequest

CreateTaskRequest.Builder

Request message for CreateTask.

Protobuf type google.cloud.tasks.v2beta2.CreateTaskRequest

DeleteQueueRequest

Request message for DeleteQueue.

Protobuf type google.cloud.tasks.v2beta2.DeleteQueueRequest

DeleteQueueRequest.Builder

Request message for DeleteQueue.

Protobuf type google.cloud.tasks.v2beta2.DeleteQueueRequest

DeleteTaskRequest

Request message for deleting a task using DeleteTask.

Protobuf type google.cloud.tasks.v2beta2.DeleteTaskRequest

DeleteTaskRequest.Builder

Request message for deleting a task using DeleteTask.

Protobuf type google.cloud.tasks.v2beta2.DeleteTaskRequest

GetQueueRequest

Request message for GetQueue.

Protobuf type google.cloud.tasks.v2beta2.GetQueueRequest

GetQueueRequest.Builder

Request message for GetQueue.

Protobuf type google.cloud.tasks.v2beta2.GetQueueRequest

GetTaskRequest

Request message for getting a task using GetTask.

Protobuf type google.cloud.tasks.v2beta2.GetTaskRequest

GetTaskRequest.Builder

Request message for getting a task using GetTask.

Protobuf type google.cloud.tasks.v2beta2.GetTaskRequest

LeaseTasksRequest

Request message for leasing tasks using LeaseTasks.

Protobuf type google.cloud.tasks.v2beta2.LeaseTasksRequest

LeaseTasksRequest.Builder

Request message for leasing tasks using LeaseTasks.

Protobuf type google.cloud.tasks.v2beta2.LeaseTasksRequest

LeaseTasksResponse

Response message for leasing tasks using LeaseTasks.

Protobuf type google.cloud.tasks.v2beta2.LeaseTasksResponse

LeaseTasksResponse.Builder

Response message for leasing tasks using LeaseTasks.

Protobuf type google.cloud.tasks.v2beta2.LeaseTasksResponse

ListQueuesRequest

Request message for ListQueues.

Protobuf type google.cloud.tasks.v2beta2.ListQueuesRequest

ListQueuesRequest.Builder

Request message for ListQueues.

Protobuf type google.cloud.tasks.v2beta2.ListQueuesRequest

ListQueuesResponse

Response message for ListQueues.

Protobuf type google.cloud.tasks.v2beta2.ListQueuesResponse

ListQueuesResponse.Builder

Response message for ListQueues.

Protobuf type google.cloud.tasks.v2beta2.ListQueuesResponse

ListTasksRequest

Request message for listing tasks using ListTasks.

Protobuf type google.cloud.tasks.v2beta2.ListTasksRequest

ListTasksRequest.Builder

Request message for listing tasks using ListTasks.

Protobuf type google.cloud.tasks.v2beta2.ListTasksRequest

ListTasksResponse

Response message for listing tasks using ListTasks.

Protobuf type google.cloud.tasks.v2beta2.ListTasksResponse

ListTasksResponse.Builder

Response message for listing tasks using ListTasks.

Protobuf type google.cloud.tasks.v2beta2.ListTasksResponse

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

PauseQueueRequest

Request message for PauseQueue.

Protobuf type google.cloud.tasks.v2beta2.PauseQueueRequest

PauseQueueRequest.Builder

Request message for PauseQueue.

Protobuf type google.cloud.tasks.v2beta2.PauseQueueRequest

ProjectName

ProjectName.Builder

Builder for ProjectName.

PullMessage

The pull message contains data that can be used by the caller of LeaseTasks to process the task. This proto can only be used for tasks in a queue which has pull_target set.

Protobuf type google.cloud.tasks.v2beta2.PullMessage

PullMessage.Builder

The pull message contains data that can be used by the caller of LeaseTasks to process the task. This proto can only be used for tasks in a queue which has pull_target set.

Protobuf type google.cloud.tasks.v2beta2.PullMessage

PullTarget

Pull target.

Protobuf type google.cloud.tasks.v2beta2.PullTarget

PullTarget.Builder

Pull target.

Protobuf type google.cloud.tasks.v2beta2.PullTarget

PurgeQueueRequest

Request message for PurgeQueue.

Protobuf type google.cloud.tasks.v2beta2.PurgeQueueRequest

PurgeQueueRequest.Builder

Request message for PurgeQueue.

Protobuf type google.cloud.tasks.v2beta2.PurgeQueueRequest

Queue

A queue is a container of related tasks. Queues are configured to manage how those tasks are dispatched. Configurable properties include rate limits, retry options, target types, and others.

Protobuf type google.cloud.tasks.v2beta2.Queue

Queue.Builder

A queue is a container of related tasks. Queues are configured to manage how those tasks are dispatched. Configurable properties include rate limits, retry options, target types, and others.

Protobuf type google.cloud.tasks.v2beta2.Queue

QueueName

QueueName.Builder

Builder for projects/{project}/locations/{location}/queues/{queue}.

QueueProto

QueueStats

Statistics for a queue.

Protobuf type google.cloud.tasks.v2beta2.QueueStats

QueueStats.Builder

Statistics for a queue.

Protobuf type google.cloud.tasks.v2beta2.QueueStats

RateLimits

Rate limits. This message determines the maximum rate that tasks can be dispatched by a queue, regardless of whether the dispatch is a first task attempt or a retry. Note: The debugging command, RunTask, will run a task even if the queue has reached its RateLimits.

Protobuf type google.cloud.tasks.v2beta2.RateLimits

RateLimits.Builder

Rate limits. This message determines the maximum rate that tasks can be dispatched by a queue, regardless of whether the dispatch is a first task attempt or a retry. Note: The debugging command, RunTask, will run a task even if the queue has reached its RateLimits.

Protobuf type google.cloud.tasks.v2beta2.RateLimits

RenewLeaseRequest

Request message for renewing a lease using RenewLease.

Protobuf type google.cloud.tasks.v2beta2.RenewLeaseRequest

RenewLeaseRequest.Builder

Request message for renewing a lease using RenewLease.

Protobuf type google.cloud.tasks.v2beta2.RenewLeaseRequest

ResumeQueueRequest

Request message for ResumeQueue.

Protobuf type google.cloud.tasks.v2beta2.ResumeQueueRequest

ResumeQueueRequest.Builder

Request message for ResumeQueue.

Protobuf type google.cloud.tasks.v2beta2.ResumeQueueRequest

RetryConfig

Retry config. These settings determine how a failed task attempt is retried.

Protobuf type google.cloud.tasks.v2beta2.RetryConfig

RetryConfig.Builder

Retry config. These settings determine how a failed task attempt is retried.

Protobuf type google.cloud.tasks.v2beta2.RetryConfig

RunTaskRequest

Request message for forcing a task to run now using RunTask.

Protobuf type google.cloud.tasks.v2beta2.RunTaskRequest

RunTaskRequest.Builder

Request message for forcing a task to run now using RunTask.

Protobuf type google.cloud.tasks.v2beta2.RunTaskRequest

TargetProto

Task

A unit of scheduled work.

Protobuf type google.cloud.tasks.v2beta2.Task

Task.Builder

A unit of scheduled work.

Protobuf type google.cloud.tasks.v2beta2.Task

TaskName

TaskName.Builder

Builder for projects/{project}/locations/{location}/queues/{queue}/tasks/{task}.

TaskProto

TaskStatus

Status of the task.

Protobuf type google.cloud.tasks.v2beta2.TaskStatus

TaskStatus.Builder

Status of the task.

Protobuf type google.cloud.tasks.v2beta2.TaskStatus

UpdateQueueRequest

Request message for UpdateQueue.

Protobuf type google.cloud.tasks.v2beta2.UpdateQueueRequest

UpdateQueueRequest.Builder

Request message for UpdateQueue.

Protobuf type google.cloud.tasks.v2beta2.UpdateQueueRequest

Interfaces

AcknowledgeTaskRequestOrBuilder

AppEngineHttpRequestOrBuilder

AppEngineHttpTargetOrBuilder

AppEngineRoutingOrBuilder

AttemptStatusOrBuilder

CancelLeaseRequestOrBuilder

CreateQueueRequestOrBuilder

CreateTaskRequestOrBuilder

DeleteQueueRequestOrBuilder

DeleteTaskRequestOrBuilder

GetQueueRequestOrBuilder

GetTaskRequestOrBuilder

LeaseTasksRequestOrBuilder

LeaseTasksResponseOrBuilder

ListQueuesRequestOrBuilder

ListQueuesResponseOrBuilder

ListTasksRequestOrBuilder

ListTasksResponseOrBuilder

PauseQueueRequestOrBuilder

PullMessageOrBuilder

PullTargetOrBuilder

PurgeQueueRequestOrBuilder

QueueOrBuilder

QueueStatsOrBuilder

RateLimitsOrBuilder

RenewLeaseRequestOrBuilder

ResumeQueueRequestOrBuilder

RetryConfigOrBuilder

RunTaskRequestOrBuilder

TaskOrBuilder

TaskStatusOrBuilder

UpdateQueueRequestOrBuilder

Enums

HttpMethod

The HTTP method used to execute the task.

Protobuf enum google.cloud.tasks.v2beta2.HttpMethod

Queue.State

State of the queue.

Protobuf enum google.cloud.tasks.v2beta2.Queue.State

Queue.TargetTypeCase

RetryConfig.NumAttemptsCase

Task.PayloadTypeCase

Task.View

The view specifies a subset of Task data. When a task is returned in a response, not all information is retrieved by default because some data, such as payloads, might be desirable to return only when needed because of its large size or because of the sensitivity of data that it contains.

Protobuf enum google.cloud.tasks.v2beta2.Task.View