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 — java-docs-samples/flexible/pubsub at master · SyCode7/java-docs-samples

Expand file tree

/

pubsub

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

pubsub

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src/main
src/main
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 
sample_message.json
sample_message.json
 
 

README.md

Outline

App Engine Flexible Environment - Pub/Sub Sample

Clone the sample app

Copy the sample apps to your local machine, and cd to the pubsub directory:

git clone https://github.com/GoogleCloudPlatform/java-docs-samples
cd java-docs-samples/flexible/pubsub

Setup

Make sure gcloud is installed and authenticated.

Create a topic

gcloud beta pubsub topics create <your-topic-name>

Create a push subscription, to send messages to a Google Cloud Project URL such as https://.appspot.com/push.

gcloud beta pubsub subscriptions create <your-subscription-name> \
  --topic <your-topic-name> \
  --push-endpoint \
  https://<your-project-id>.appspot.com/pubsub/push?token=<your-verification-token> \
  --ack-deadline 30

Run

Set the following environment variables and run using shown Maven command. You can then direct your browser to http://localhost:8080/

export PUBSUB_TOPIC=<your-topic-name>
export PUBSUB_VERIFICATION_TOKEN=<your-verification-token>
mvn jetty:run

Send fake subscription push messages with:

curl -H "Content-Type: application/json" -i --data @sample_message.json
"localhost:8080/pubsub/push?token=<your-token>"

Deploy

Update the environment variables PUBSUB_TOPIC and PUBSUB_VERIFICATION_TOKEN in app.yaml, then:

mvn appengine:deploy

The home page of this application provides a form to publish messages and also provides a view of the most recent messages received over the push endpoint and persisted in storage.

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.