8000 Minor Fixes for Cloud Tasks Sample (#1027) · zqian/java-docs-samples@f383b55 · GitHub
[go: up one dir, main page]

Skip to content

Commit f383b55

Browse files
authored
Minor Fixes for Cloud Tasks Sample (GoogleCloudPlatform#1027)
* Set ResponseView to full. * Correct mistake in README for flex app.
1 parent 87b075a commit f383b55

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

cloud-tasks/src/main/java/com.example.cloudtasks/PullQueue.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ private static Task pullTask(
113113
// Create the Cloud Tasks Client
114114
CloudTasks client = createAuthorizedClient();
115115

116-
// Create the PullTasksRequest
117-
LeaseTasksRequest request = new LeaseTasksRequest().setMaxTasks(1).setLeaseDuration("600s");
116+
// Create the LeaseTasksRequest
117+
LeaseTasksRequest request = new LeaseTasksRequest()
118+
.setMaxTasks(1)
119+
.setLeaseDuration("600s")
120+
.setResponseView("FULL");
118121

119122
//Execute the request and return the pulled task
120123
LeaseTasksResponse response = client

flexible/cloud-tasks/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,19 @@ export LOCATION_ID=<YOUR_ZONE>
6262
export QUEUE_ID=<YOUR_QUEUE_NAME>
6363
```
6464

65-
Next, you can send a POST request to trigger the /create_task endpoint:
65+
Next, you can send a POST request to trigger the `/create_task`
66+
endpoint:
6667
```bash
6768
curl -d "project=$PROJECT_ID" \
6869
-d "location=$LOCATION_ID" \
6970
-d "queue=$QUEUE_ID" \
7071
-d "message=Hello World!" \
71-
--request POST https://<YOUR_PROJECT_URL>.appspot.com/
72+
--request POST https://<YOUR_PROJECT_URL>.appspot.com/create_task
7273
```
7374

74-
This endpoint will create a Cloud Tasks to trigger the `/log_payload`
75-
endpoint, which will be visible the application's logs:
75+
This endpoint will create a Cloud Task to trigger the
76+
`/example_task_handler` endpoint, which will be visible the
77+
application's logs:
7678
```
7779
Received task with payload: Hello World!
7880
```

0 commit comments

Comments
 (0)
0