Skip to content

Minor Fixes for Cloud Tasks Sample #1027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ private static Task pullTask(
// Create the Cloud Tasks Client
CloudTasks client = createAuthorizedClient();

// Create the PullTasksRequest
LeaseTasksRequest request = new LeaseTasksRequest().setMaxTasks(1).setLeaseDuration("600s");
// Create the LeaseTasksRequest
LeaseTasksRequest request = new LeaseTasksRequest()
.setMaxTasks(1)
.setLeaseDuration("600s")
.setResponseView("FULL");

//Execute the request and return the pulled task
LeaseTasksResponse response = client
Expand Down
10 changes: 6 additions & 4 deletions flexible/cloud-tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ export LOCATION_ID=<YOUR_ZONE>
export QUEUE_ID=<YOUR_QUEUE_NAME>
```

Next, you can send a POST request to trigger the /create_task endpoint:
Next, you can send a POST request to trigger the `/create_task`
endpoint:
```bash
curl -d "project=$PROJECT_ID" \
-d "location=$LOCATION_ID" \
-d "queue=$QUEUE_ID" \
-d "message=Hello World!" \
--request POST https://<YOUR_PROJECT_URL>.appspot.com/
--request POST https://<YOUR_PROJECT_URL>.appspot.com/create_task
```

This endpoint will create a Cloud Tasks to trigger the `/log_payload`
endpoint, which will be visible the application's logs:
This endpoint will create a Cloud Task to trigger the
`/example_task_handler` endpoint, which will be visible the
application's logs:
```
Received task with payload: Hello World!
```