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/generic at master · alpayo/java-docs-samples

Expand file tree

/

generic

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

generic

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Eventarc - Generic

This sample shows how to create a service that processes generic CloudEvents.

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

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

mvn jib:build -Dimage gcr.io/$(gcloud config get-value project)/eventarc-generic

Deploy your Cloud Run service:

gcloud run deploy eventarc-generic \
--image gcr.io/$(gcloud config get-value project)/eventarc-generic

Test

Test your Cloud Run service by sending CloudEvents:

CLOUD_RUN_URL=$(gcloud run services describe eventarc-generic --platform managed --format 'value(status.url)')
curl -XPOST $CLOUD_RUN_URL \
-H "Content-Type: application/json" \
-H "ce-id: 1413058901901494" \
-H "ce-source: //books.googleapis.com/book/MY-BOOK" \
-H "ce-specversion: 1.0" \
-H "ce-type: my-type" \
-d '{"key": "value"}'

You may observe the Cloud 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.