1- # Google Cloud Tasks Pull Queue Samples
1+ # Google Cloud Tasks App Engine Queue Samples
22
3- ## THIS SAMPLE IS CURRENTLY INCOMPLETE. PLEASE REFER TO [ THE DOCUMENTATION ] ( https://cloud.google.com/tasks/docs/ )
3+ ## Description
44
5- Sample command-line program for interacting with the Google Cloud Tasks API.
6-
7- ` tasks.php ` is a simple command-line program to demonstrate listing queues,
8- creating tasks, and pulling and acknowledging tasks.
9-
10- ` src/create_task.php ` is a simple function to create pull queue tasks.
5+ Al code in the snippets directory demonstrate how to invoke Cloud Tasks from PHP.
116
7+ ` src/create_task.php ` is a simple function to create app engine queue tasks.
128
139## Setup:
1410
@@ -22,17 +18,45 @@ Sample command-line program for interacting with the Google Cloud Tasks API.
2218
2319 ``` sh
2420 $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
25- $ cd php-docs-samples/tasks
21+ $ cd php-docs-samples/appengine/php72/ tasks
2622 ```
27234. ** Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
2824 Run ` php composer.phar install` (if composer is installed locally) or ` composer install`
2925 (if composer is installed globally).
3026
31- # # Creating a queue
27+ 5. Create a Queue
28+ To create a queue using the Cloud SDK, use the following gcloud command:
29+ ` ` ` sh
30+ gcloud beta tasks queues create-app-engine-queue my-appengine-queue
31+ ` ` `
32+ 6. Identify the Location
3233
33- To create a queue using the Cloud SDK, use the following gcloud command:
34+ Determine the location ID, which can be discovered with
35+ ` gcloud alpha tasks queues describe $QUEUE_ID ` , with the location embedded in
36+ the " name" value (for instance, if the name is
37+ " projects/my-project/locations/us-central1/queues/my-pull-queue" , then the
38+ location is " us-central1" ).
39+
40+ 7. Run ` php src/SNIPPET_NAME.php` . The usage will print for each if no arguments are provided:
41+
42+ ` ` `
43+ $> php src/create_task.php
44+ Usage: php src/create_task.php PROJECT_ID LOCATION_ID QUEUE_ID [PAYLOAD]
45+ ` ` `
46+
47+ # # Contributing changes
48+
49+ * See [CONTRIBUTING.md](../../CONTRIBUTING.md)
50+
51+ # # Licensing
52+
53+ * See [LICENSE](../../LICENSE)
54+
55+
56+
57+
58+ # # Creating a queue
3459
35- gcloud beta tasks queues create-app-engine-queue my-appengine-queue
3660
3761# # Running the Samples
3862
@@ -49,14 +73,3 @@ created can be listed with `gcloud alpha tasks queues list`.
4973
5074 export QUEUE_ID=my-appengine-queue
5175
52- And finally the location ID, which can be discovered with
53- ` gcloud alpha tasks queues describe $QUEUE_ID ` , with the location embedded in
54- the " name" value (for instance, if the name is
55- " projects/my-project/locations/us-central1/queues/my-pull-queue" , then the
56- location is " us-central1" ).
57-
58- export LOCATION_ID=us-central1
59-
60- Create a task for a queue:
61-
62- php tasks.php create-task $PROJECT_ID $QUEUE_ID $LOCATION_ID --payload=hello
0 commit comments