Skip to content

appengine standard env and flex env with pubsub#120

Closed
willedwards wants to merge 2 commits into
GoogleCloudPlatform:masterfrom
willedwards:master
Closed

appengine standard env and flex env with pubsub#120
willedwards wants to merge 2 commits into
GoogleCloudPlatform:masterfrom
willedwards:master

Conversation

@willedwards

@willedwards willedwards commented Sep 16, 2016

Copy link
Copy Markdown

Demo of async messaging from appengine, to gcloud pubsub, along with a callback url to be triggered after an event has been processed.

This contains code for both the standard and flex appengines, using gcloud pubub. I needed this, and it was missing, so I hope it's useful for others who want a template for async messaging and callbacks.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 16, 2016
@lesv

lesv commented Sep 26, 2016

Copy link
Copy Markdown
Contributor

Travis says:

[INFO] Building pubsub-springboot 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] Could not transfer metadata com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from/to codehaus-snapshots (https://nexus.codehaus.org/snapshots/): nexus.codehaus.org: unknown error
[WARNING] Failure to transfer com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from https://nexus.codehaus.org/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of codehaus-snapshots has elapsed or updates are forced. Original error: Could not transfer metadata com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from/to codehaus-snapshots (https://nexus.codehaus.org/snapshots/): nexus.codehaus.org: unknown error
[INFO] pubsub-springboot .................................. FAILURE [  2.377 s]
[ERROR] Failed to execute goal on project pubsub-springboot: Could not resolve dependencies for project com.example.flex.gettingstarted:pubsub-springboot:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.travellazy.google.pubsub:client:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.travellazy.google.pubsub:client:jar:1.0-SNAPSHOT: Could not transfer artifact com.travellazy.google.pubsub:client:pom:1.0-SNAPSHOT from/to codehaus-snapshots (https://nexus.codehaus.org/snapshots/): nexus.codehaus.org: Unknown host nexus.codehaus.org -> [Help 1]

@lesv

lesv commented Sep 27, 2016

Copy link
Copy Markdown
Contributor

Wow - Thanks -- Could you put apache licenses on the source files please. If you could fix travis that would be great, but if you add the licenses, I can figure out travis.

@willedwards

Copy link
Copy Markdown
Author

Hi Les.
Thanks for your encouragement. I'm happy to help out. However I need some pointers.
I believe the first step is to get the wrapper project open sourced into mvn central, or some public repo. This would fix the broken build.

Alternatively I'm happy to hand over the repository (https://github.com/willedwards/google-pubsub-clientwrapper). I have added the licence files.

Any advice most welcome.

@lesv

lesv commented Nov 1, 2016

Copy link
Copy Markdown
Contributor

We've now pushed the wrapper to maven-central: com.google.cloud.samples shared-configuration

If that's enough cool. You might wish to consider moving the sample to a new repo we just created and are in the process of populating. github.com/googlecloudplatform/spring-samples

@willedwards

Copy link
Copy Markdown
Author

Hi Les

Ok. I refactored the wrapper last night, so you've probably pulled that - which is good. Please let me know when the github.com/googlecloudplatform/spring-samples is ready for contribution as I can add both an appengine standard and appengine flex environment example that send to google pubsub.

@willedwards

Copy link
Copy Markdown
Author

On another note : I'm a bit confused by the official documentation I saw
https://cloud.google.com/pubsub/docs/publisher#list

because the sample code points at
https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-examples.

but, not to this repo. So which repo should I be using ? because each repo has a different set of core pubsub dependencies.

@willedwards

Copy link
Copy Markdown
Author

I have just pushed the latest version of my code here. This version still uses my wrapper, but, only needs the projectId in two places (appengine-web.xml and application.properties).

This code allows topics and subscriptions to be created without thinking about /project/projectId/topics/ etc. It just works under the covers as it is abstracted away.

It also lists the topics and subscriptions via GET endpoints, but using the PubSub client under the covers, again, abstracted away.

I also added some basic tests, but these need building out.

Finally, as before, the register callback allows another endpoint to be triggered by the subscription push.

I decided that using types gave certain advantages:

  • forces the caller to create things in order -> topic, subscription, then register the callback.
  • no ambiguity in the method signatures.

@lesv

lesv commented Nov 3, 2016

Copy link
Copy Markdown
Contributor

I'm going to need to check internally regarding using your wrapper as a key step. What we usually do if it has to happen is include the source in a THIRD_PARTY directory where appropriate, rather than how you've done it. (You can include a README of some kind pointing folks to your repository) It should have an Apache License. I also note, you haven't passed travis.

[WARNING] Could not transfer metadata com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from/to apache-snapshots (https://repository.apache.org/snapshots/): Connect to repository.apache.org:443 [repository.apache.org/207.244.88.143] failed: Connection timed out
[WARNING] Could not transfer metadata com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from/to codehaus-snapshots (https://nexus.codehaus.org/snapshots/): nexus.codehaus.org: unknown error
[WARNING] Failure to transfer com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from https://repository.apache.org/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of apache-snapshots has elapsed or updates are forced. Original error: Could not transfer metadata com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from/to apache-snapshots (https://repository.apache.org/snapshots/): Connect to repository.apache.org:443 [repository.apache.org/207.244.88.143] failed: Connection timed out
[WARNING] Failure to transfer com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from https://nexus.codehaus.org/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of codehaus-snapshots has elapsed or updates are forced. Original error: Could not transfer metadata com.travellazy.google.pubsub:client:1.0-SNAPSHOT/maven-metadata.xml from/to codehaus-snapshots (https://nexus.codehaus.org/snapshots/): nexus.codehaus.org: unknown error
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] pubsub-springboot .................................. FAILURE [06:30 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10:52 min
[INFO] Finished at: 2016-11-01T23:17:25+00:00
[INFO] Final Memory: 51M/478M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project pubsub-springboot: Could not resolve dependencies for project com.example.flex.gettingstarted:pubsub-springboot:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.travellazy.google.pubsub:client:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.travellazy.google.pubsub:client:jar:1.0-SNAPSHOT: Could not transfer artifact com.travellazy.google.pubsub:client:pom:1.0-SNAPSHOT from/to apache-snapshots (https://repository.apache.org/snapshots/): Connect to repository.apache.org:443 [repository.apache.org/207.244.88.143] failed: Connection timed out -> [Help 1]

@lesv

lesv commented Jan 14, 2020

Copy link
Copy Markdown
Contributor

I'm not sure what happened to this, but I'm going to close.

@lesv lesv closed this Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants