Class HttpRequest (1.5.2)

HTTP request.

The task will be pushed to the worker as an HTTP request. If the worker or the redirected worker acknowledges the task by returning a successful HTTP response code ([200 - 299]), the task will be removed from the queue. If any other HTTP response code is returned or no response is received, the task will be retried according to the following:

  • User-specified throttling: [retry configuration][google.cloud.tasks.v2.Queue.retry_config], [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue's state][google.cloud.tasks.v2.Queue.state].

  • System throttling: To prevent the worker from overloading, Cloud Tasks may temporarily reduce the queue's effective rate. User-specified settings will not be changed.

System throttling happens because:

  • Cloud Tasks backs off on all errors. Normally the backoff specified in [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But if the worker returns 429 (Too Many Requests), 503 (Service Unavailable), or the rate of errors is high, Cloud Tasks will use a higher backoff rate. The retry specified in the Retry-After HTTP response header is considered.

  • To prevent traffic spikes and to smooth sudden increases in traffic, dispatches ramp up slowly when the queue is newly created or idle and if large numbers of tasks suddenly become available to dispatch (due to spikes in create task rates, the queue being unpaused, or many tasks that are scheduled at the same time).

    The HTTP method to use for the request. The default is POST.

    HTTP request body. A request body is allowed only if the [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT, or PATCH. It is an error to set body on a task with an incompatible HttpMethod.

    If specified, an OAuth token <https://developers.google.com/identity/protocols/OAuth2>_ will be generated and attached as an Authorization header in the HTTP request. This type of authorization should generally only be used when calling Google APIs hosted on *.googleapis.com.

Classes

HeadersEntry

API documentation for tasks_v2.types.HttpRequest.HeadersEntry class.