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/eventarc/pubsub at main · annadata/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
src
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Eventarc - Pub/Sub

This sample shows how to create a service that processes Pub/Sub messages.

For more details on how to work with this sample read the Google Cloud Run Java Samples README.

Run in Google Cloud

Dependencies

  • Spring Boot: Web server framework.
  • Jib: Container build tool.
  • Junit + SpringBootTest: [development] Test running framework.
  • MockMVC: [development] Integration testing support framework.

Quickstart

Create a Cloud Pub/Sub topic:

gcloud pubsub topics create my-topic

Use the Jib Maven Plugin to build and push your container image:

mvn jib:build -Dimage gcr.io/$(gcloud config get-value project)/cloudrun-events-pubsub

Deploy your Cloud Run service:

gcloud run deploy cloudrun-events-pubsub \
--image gcr.io/$(gcloud config get-value project)/cloudrun-events-pubsub

Create a Cloud Pub/Sub trigger:

gcloud eventarc triggers create events-pubsub-trigger \
  --destination-run-service=cloudrun-events-pubsub \
  --destination-run-region=us-central1 \
  --event-filters="type=google.cloud.pubsub.topic.v1.messagePublished"

Test

Test your Cloud Run service by publishing a message to the topic:

export RUN_TOPIC=$(gcloud eventarc triggers describe events-pubsub-trigger \
  --format='value(transport.pubsub.topic)')
gcloud pubsub topics publish $RUN_TOPIC --message "Runner"

You may observe the Run service receiving an event in Cloud Logging.

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.