Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

App Engine Flexible Environment - Pub/Sub Sample

Open in Cloud Shell

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 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 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

Deploy

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

mvn clean package 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.