Show / Hide Table of Contents

Class ProjectsResource.LocationsResource.QueuesResource.TasksResource

The "tasks" collection of methods.

Inheritance
object
ProjectsResource.LocationsResource.QueuesResource.TasksResource
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Google.Apis.CloudTasks.v2beta2
Assembly: Google.Apis.CloudTasks.v2beta2.dll
Syntax
public class ProjectsResource.LocationsResource.QueuesResource.TasksResource

Constructors

TasksResource(IClientService)

Constructs a new resource.

Declaration
public TasksResource(IClientService service)
Parameters
Type Name Description
IClientService service

Methods

Acknowledge(AcknowledgeTaskRequest, string)

Acknowledges a pull task. The worker, that is, the entity that leased this task must call this method to indicate that the work associated with the task has finished. The worker must acknowledge a task within the 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, GetTask, or ListTasks.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.AcknowledgeRequest Acknowledge(AcknowledgeTaskRequest body, string name)
Parameters
Type Name Description
AcknowledgeTaskRequest body

The body of the request.

string name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.AcknowledgeRequest

Buffer(BufferTaskRequest, string, string)

Creates and buffers a new task without the need to explicitly define a Task message. The queue must have HTTP target. To create the task with a custom ID, use the following format and set TASK_ID to your desired ID: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer To create the task with an automatically generated ID, use the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.BufferRequest Buffer(BufferTaskRequest body, string queue, string taskId)
Parameters
Type Name Description
BufferTaskRequest body

The body of the request.

string queue

Required. The parent queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` The queue must already exist.

string taskId

Optional. Task ID for the task being created. If not provided, a random task ID is assigned to the task.

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.BufferRequest

CancelLease(CancelLeaseRequest, string)

Cancel a pull task's lease. The worker can use this method to cancel a task's lease by setting its schedule_time to now. This will make the task available to be leased to the next caller of LeaseTasks.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.CancelLeaseRequest CancelLease(CancelLeaseRequest body, string name)
Parameters
Type Name Description
CancelLeaseRequest body

The body of the request.

string name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.CancelLeaseRequest

Create(CreateTaskRequest, string)

Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * For App Engine queues, the maximum task size is 100KB. * For pull queues, the maximum task size is 1MB.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.CreateRequest Create(CreateTaskRequest body, string parent)
Parameters
Type Name Description
CreateTaskRequest body

The body of the request.

string parent

Required. The queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID The queue must already exist.

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.CreateRequest

Delete(string)

Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has completed successfully or permanently failed.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.DeleteRequest Delete(string name)
Parameters
Type Name Description
string name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.DeleteRequest

Get(string)

Gets a task.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.GetRequest Get(string name)
Parameters
Type Name Description
string name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.GetRequest

Lease(LeaseTasksRequest, string)

Leases tasks from a pull queue for lease_duration. This method is invoked by the worker to obtain a lease. The worker must acknowledge the task via AcknowledgeTask after they have performed the work associated with the task. The payload is intended to store data that the worker needs to perform the work associated with the task. To return the payloads in the response, set response_view to FULL. A maximum of 10 qps of LeaseTasks requests are allowed per queue. RESOURCE_EXHAUSTED is returned when this limit is exceeded. RESOURCE_EXHAUSTED is also returned when max_tasks_dispatched_per_second is exceeded.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.LeaseRequest Lease(LeaseTasksRequest body, string parent)
Parameters
Type Name Description
LeaseTasksRequest body

The body of the request.

string parent

Required. The queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.LeaseRequest

List(string)

Lists the tasks in a queue. By default, only the BASIC view is retrieved due to performance considerations; response_view controls the subset of information which is returned. The tasks may be returned in any order. The ordering may change at any time.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.ListRequest List(string parent)
Parameters
Type Name Description
string parent

Required. The queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.ListRequest

RenewLease(RenewLeaseRequest, string)

Renew the current lease of a pull task. The worker can use this method to extend the lease by a new duration, starting from now. The new task lease will be returned in the task's schedule_time.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.RenewLeaseRequest RenewLease(RenewLeaseRequest body, string name)
Parameters
Type Name Description
RenewLeaseRequest body

The body of the request.

string name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.RenewLeaseRequest

Run(RunTaskRequest, string)

Forces a task to run now. When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its RateLimits or is PAUSED. This command is meant to be used for manual debugging. For example, RunTask can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now. The dispatched task is returned. That is, the task that is returned contains the status after the task is dispatched but before the task is received by its target. If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's schedule_time will be reset to the time that RunTask was called plus the retry delay specified in the queue's RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has already succeeded or permanently failed. RunTask cannot be called on a pull task.

Declaration
public virtual ProjectsResource.LocationsResource.QueuesResource.TasksResource.RunRequest Run(RunTaskRequest body, string name)
Parameters
Type Name Description
RunTaskRequest body

The body of the request.

string name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

Returns
Type Description
ProjectsResource.LocationsResource.QueuesResource.TasksResource.RunRequest
In this article
Back to top Generated by DocFX