GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add task create & lease/acknowledge sample. by dzlier-gcp · Pull Request #1153 · GoogleCloudPlatform/java-docs-samples

Conversation

@dzlier-gcp

@dzlier-gcp dzlier-gcp commented Jul 13, 2018

Copy link
Copy Markdown
Member

Still working on the appengine version, but thought I would create the pull request now so reviews can start, since we were wanting this done by EOD.

I do not have a README currently because the content seems copied from the documentation at https://cloud.google.com/tasks/docs/quickstart-pull, which someone else will be working on this weekend. I will grab it from there and pull it down when it is done.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dzlier-gcp
dzlier-gcp requested review from kurtisvg and paulrossman July 13, 2018 19:31
@googlebot

googlebot commented Jul 13, 2018

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Jul 13, 2018
@dzlier-gcp
dzlier-gcp force-pushed the master branch 6 times, most recently from bd33182 to a8ea5c3 Compare July 13, 2018 22:31
@dzlier-gcp
Add task create & lease/acknowledge sample.
9e402fc
@dzlier-gcp
dzlier-gcp force-pushed the master branch from a8ea5c3 to 3a7df9d Compare July 13, 2018 22:34
@googlebot

googlebot commented Jul 13, 2018

Copy link
Copy Markdown

CLAs look good, thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 13, 2018
@kurtisvg kurtisvg added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 14, 2018
kurtisvg
kurtisvg suggested changes Jul 14, 2018
View reviewed changes
Comment thread appengine-java8/tasks/src/main/java/com/example/task/CreateTask.java Outdated
.build();

public static void main(String... args) throws Exception {
// [START cloud_tasks_appengine_create_task]

@kurtisvg kurtisvg Jul 14, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that you want the region tag to start here? It feels like most of the command line parsing isn't relevant enough that we want to link to it from elsewhere.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dzlier-gcp dzlier-gcp Jul 14, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure, but I also wanted to include enough context to understand what was happening. I don't know if these tags are used in the documentation, I was just copying them from the python sample. But I don't mind moving it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread appengine-java8/tasks/src/main/java/com/example/task/TaskServlet.java
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
log.info("Received task request: " + req.getServletPath());
if (req.getParameter("payload") != null) {

@kurtisvg kurtisvg Jul 14, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to add a line of logging for when the payload is null - that way if the user forgets to set a payload the endpoint will still logged that it was triggered.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dzlier-gcp dzlier-gcp Jul 14, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These log statements were actually just for my debugging purposes initially, but yeah I can add one for a null payload. Warning level probably, since it doesn't affect the execution?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@kurtisvg kurtisvg Jul 14, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically logging is debug < info < warning < critical, so using ' debug' or 'info' is probably typical (but I don't think it makes a big difference for a smaller application).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tasks/pom.xml Outdated
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
</plugin>
<plugin>

@kurtisvg kurtisvg Jul 14, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is building the jar with dependencies required for deployment? If not, can we remove this section?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tasks/src/main/java/com/example/Quickstart.java Outdated
// [START cloud_tasks_lease_and_acknowledge_task]
private static void pullAndAckTask(String projectId, String queueName, String location) {
try (CloudTasksClient client = CloudTasksClient.create()) {
LeaseTasksRequest.Builder reqBuilder = LeaseTasksRequest.newBuilder()

@kurtisvg kurtisvg Jul 14, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you are passing a builder instead of just the request?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dzlier-gcp dzlier-gcp Jul 14, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not, on line 148 it passes reqBuilder.build()

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dzlier-gcp dzlier-gcp Jul 14, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do you mean declaring it locally as a request instead of a builder? If I'm taking the Ack request out into a var below, I'll do the same here for consistency.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@kurtisvg kurtisvg Jul 14, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup that's what I meant - typically the builder pattern is a replacement for new, so it seems weird to trigger the build there. Looks good now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tasks/src/main/java/com/example/Quickstart.java Outdated
}
Task task = response.getTasksList().get(0);
System.out.println("Leased task: " + task.getName());
client.acknowledgeTask(AcknowledgeTaskRequest

@kurtisvg kurtisvg Jul 14, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about building the AcknowledgeTaskRequest before the function and passing it in? I think it increases readability and makes it more obvious what the function requires.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dzlier-gcp dzlier-gcp Jul 14, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fine.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dzlier-gcp
Add Appengine Queue Tasks sample.
c677bb7
@dzlier-gcp
dzlier-gcp force-pushed the master branch from 3a7df9d to c677bb7 Compare July 14, 2018 20:28
@dzlier-gcp
Merge branch 'master' into master
7398f4a
@dzlier-gcp

dzlier-gcp commented Jul 14, 2018

Copy link
Copy Markdown
Member Author

Requested changes done.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kurtisvg
kurtisvg approved these changes Jul 14, 2018
View reviewed changes
@dzlier-gcp
dzlier-gcp merged commit a977aec into GoogleCloudPlatform:master Jul 14, 2018
averikitsch pushed a commit that referenced this pull request Oct 27, 2022
@dzlier-gcp @chingor13
samples: Add task create & lease/acknowledge sample. (#1153)
e21d145
* Add task create & lease/acknowledge sample.

* Add Appengine Queue Tasks sample.
@averikitsch averikitsch mentioned this pull request Oct 27, 2022
migrate code from googleapis/java-tasks #7368
Merged
9 tasks
averikitsch pushed a commit that referenced this pull request Nov 1, 2022
@dzlier-gcp @averikitsch
samples: Add task create & lease/acknowledge sample. (#1153)
67c84a4
* Add task create & lease/acknowledge sample.

* Add Appengine Queue Tasks sample.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@paulrossman paulrossman Awaiting requested review from paulrossman
1 more reviewer
@kurtisvg kurtisvg kurtisvg approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@dzlier-gcp @googlebot @kurtisvg
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.