api/taskqueue/PushTask.php

Table of Contents
Copyright 2007 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

\google\appengine\api\taskqueue\PushTask

Package: Default
A PushTask encapsulates a unit of work that an application places onto a Push Queue for asnychronous execution.

The queue executes that work by sending the task back to the application in the form of an HTTP request to one of the application's handlers. This class is immutable.

Constants

>VConstant  MAX_DELAY_SECONDS = 2592000
A task may be scheduled up to 30 days into the future.
>VConstant  MAX_NAME_LENGTH = 500
>VConstant  MAX_TASK_SIZE_BYTES = 102400
>VConstant  MAX_URL_LENGTH = 2083
>VConstant  NAME_PATTERN = '/^[a-zA-Z0-9_-]+$/'

Methods

methodpublic__construct(string $url_path, array $query_data = array(), array $options = array()) : void

Construct a PushTask.

Parameters
NameTypeDescription
$url_pathstring

The path of the URL handler for this task relative to your application's root directory.

$query_dataarray

The data carried by task, typically in the form of a set of key value pairs. This data will be encoded using http_build_query() and will be either:

  • Added to the payload of the http request if the task's method is POST or PUT.
  • Added to the URL if the task's method is GET, HEAD, or DELETE.
$optionsarray

Additional options for the task. Valid options are:

  • 'method': string One of 'POST', 'GET', 'HEAD', 'PUT', 'DELETE'. Default value: 'POST'.
  • 'name': string Name of the task. Defaults to '' meaning the service will generate a unique task name.
  • 'delay_seconds': float The minimum time to wait before executing the task. Default: zero.
  • 'header': string Additional headers to be sent when the task executes.
methodpublicadd( $queue_name = 'default') : string

Adds the task to a queue.

Parameters
NameTypeDescription
$queue_name
Returns
TypeDescription
stringThe name of the task.
Throws
ExceptionDescription
\google\appengine\api\taskqueue\TaskAlreadyExistsExceptionif a task of the same name already exists in the queue.
\google\appengine\api\taskqueue\TaskQueueExceptionif there was a problem using the service.
methodpublicgetDelaySeconds() : float

Return the task's execution delay, in seconds.

Returns
TypeDescription
floatThe task's execution delay in seconds.
methodpublicgetHeaders() : string[]

Return the task's headers.

Returns
TypeDescription
string[]The headers that will be sent when the task is executed. This list is not exhaustive as the backend may add more headers at execution time. The array is numerically indexed and of the same format as that returned by the standard headers_list() function.
methodpublicgetMethod() : string

Return the task's HTTP method.

Returns
TypeDescription
stringThe task's HTTP method, i.e. one of 'DELETE', 'GET', 'HEAD', 'POST', 'PUT'.
methodpublicgetName() : string

Return the task's name if it was explicitly named.

Returns
TypeDescription
stringThe task's name if it was explicity named, or empty string if it will be given a uniquely generated name in the queue.
methodpublicgetQueryData() : array

Return the task's query data.

Returns
TypeDescription
arrayThe task's query data.
methodpublicgetUrl() : string

Return the task's URL.

This will be the task's URL path, plus any query parameters if the task's method is GET, HEAD, or DELETE.

Returns
TypeDescription
stringThe task's URL path.
Documentation was generated by phpDocumentor 2.0.0a12.