Add Cloud Run worker sample (worker identity + deployment versioning) - #795
Draft
seanbollin wants to merge 1 commit into
Draft
Add Cloud Run worker sample (worker identity + deployment versioning)#795seanbollin wants to merge 1 commit into
seanbollin wants to merge 1 commit into
Conversation
…oning Add a runnable Temporal Java worker sample for a Google Cloud Run worker pool. It uses io.temporal:temporal-gcp-cloud-run's GoogleCloudRunMetadata to derive the worker identity and a PINNED Worker Deployment Version from Cloud Run instance metadata, reads TEMPORAL_ADDRESS / TEMPORAL_NAMESPACE / TEMPORAL_TASK_QUEUE (plaintext connection), registers a small greeting workflow and activity, and runs until SIGTERM. Mirrors the lambda-worker sample's layout and README style, with a Dockerfile and gcloud worker-pools deploy instructions. temporal-gcp-cloud-run is not yet released, so settings.gradle wires the sample against a local SDK checkout with a Gradle composite build, defaulting to ../sdk-java-2 and overridable with -PtemporalSdkPath. This is temporary until the module is released; the PR stays a draft until then. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a runnable Temporal Java worker sample for a Google Cloud Run worker pool in
cloud-run-worker-id/. It uses the newio.temporal:temporal-gcp-cloud-runhelper(
GoogleCloudRunMetadata) to derive the worker identity and aPINNEDWorker Deployment Versionfrom Cloud Run instance metadata, reads
TEMPORAL_ADDRESS/TEMPORAL_NAMESPACE/TEMPORAL_TASK_QUEUE(plaintext connection is fine), registers a small greeting workflow +activity, and runs until
SIGTERM.It mirrors the existing
lambda-workersample's layout and README style, and includes aDockerfileand
gcloud run worker-pools deploy … --set-env-vars …instructions for Cloud Run worker pools.Why draft
The sample depends on
io.temporal:temporal-gcp-cloud-run, which is not yet released (SDK PR:temporalio/sdk-java#3028). Until it ships,
settings.gradlewires the sample against a localTemporal Java SDK checkout via a Gradle composite build (
includeBuild), defaulting to a sibling../sdk-java-2checkout and overridable with-PtemporalSdkPath=/path/to/sdk-java. The compositebuild is skipped when that checkout is absent, so the other samples still build. Once the module is
released, drop the composite-build block from
settings.gradleand bumpjavaSDKVersionin thesamples root
build.gradle, then take this PR out of draft.Files
cloud-run-worker-id/src/main/java/.../CloudRunWorker.java— long-lived worker using the helper.GreetingWorkflow[Impl]+GreetingActivities[Impl]— sample workflow/activity; the workflow is@WorkflowVersioningBehavior(PINNED)to match the worker's PINNED default.GreetingWorkflowTest.java—TestWorkflowRuleunit test (needs neither Cloud Run nor a Service).Dockerfile,README.md, and thesettings.gradlecomposite-build wiring.Testing
Gradle can't run in this environment (JDK 25 only; the repo's Gradle can't run on it), so the sample
was verified by
javac-compiling all sources (--release 17 -Xlint:all, clean) against the realGoogleCloudRunMetadataplus minimal stubs for the SDK types used, and by symbol-checking every SDKcall against the SDK sources. CI (or a local JDK 21) will run the actual Gradle build and test.
🤖 Generated with Claude Code