Skip to content

Commit 976a3a0

Browse files
committed
Rename Cloud Run Id sample to match SDK module and drop long-lived wording
1 parent 9dc533b commit 976a3a0

11 files changed

Lines changed: 30 additions & 30 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ WORKDIR /workspace
44
COPY . .
55

66
# temporal-gcp-cloud-run-id is unreleased; the composite build resolves it from a local SDK checkout (see README).
7-
RUN ./gradlew --no-daemon :gcp:cloud-run:workerid:installDist
7+
RUN ./gradlew --no-daemon :gcp:cloud-run:id:installDist
88

99
FROM eclipse-temurin:17-jre-jammy
1010

1111
RUN useradd --create-home --uid 10001 temporal
1212
WORKDIR /app
1313
COPY --from=build --chown=temporal:temporal \
14-
/workspace/gcp/cloud-run/workerid/build/install/cloud-run-worker-id/ /app/
14+
/workspace/gcp/cloud-run/id/build/install/cloud-run-id/ /app/
1515

1616
USER 10001
17-
ENTRYPOINT ["/app/bin/cloud-run-worker-id"]
17+
ENTRYPOINT ["/app/bin/cloud-run-id"]
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Temporal Cloud Run worker-identity sample
1+
# Temporal Cloud Run Id sample
22

3-
A continuously polling Temporal Java worker for a Google Cloud Run **worker pool** that registers
4-
`CloudRunIdPlugin` from `io.temporal:temporal-gcp-cloud-run-id` on the client, so the worker identity
5-
is derived from Cloud Run instance metadata as `{instanceId}@{revision}`. The plugin sets identity
6-
only. A small greeting workflow and activity run until Cloud Run stops the instance.
3+
A Temporal Java Worker for a Google Cloud Run **worker pool** that registers
4+
`CloudRunIdPlugin` from `io.temporal:temporal-gcp-cloud-run-id` on the client, so the Temporal
5+
client identity is set from Cloud Run instance metadata as `{instanceId}@{revision}`. The plugin
6+
sets identity only. A small greeting workflow and activity run until Cloud Run stops the instance.
77

88
> Google Cloud Run support is experimental and may change without notice.
99
@@ -23,38 +23,38 @@ created from the client inherit it. `GoogleCloudRunMetadata.fetch().identity()`
2323
value, which the worker logs at startup.
2424

2525
The worker reads `TEMPORAL_ADDRESS` (default `127.0.0.1:7233`), `TEMPORAL_NAMESPACE` (default
26-
`default`), and `TEMPORAL_TASK_QUEUE` (default `cloud-run-worker-id`). A plaintext connection is used;
26+
`default`), and `TEMPORAL_TASK_QUEUE` (default `cloud-run-id`). A plaintext connection is used;
2727
configure TLS or an API key in `CloudRunWorker.java` for a secured Service such as Temporal Cloud.
2828

2929
## Build and test
3030

3131
```bash
32-
./gradlew :gcp:cloud-run:workerid:test
33-
./gradlew -PtemporalSdkPath=/path/to/sdk-java :gcp:cloud-run:workerid:installDist
32+
./gradlew :gcp:cloud-run:id:test
33+
./gradlew -PtemporalSdkPath=/path/to/sdk-java :gcp:cloud-run:id:installDist
3434
```
3535

3636
## Deploy
3737

38-
Worker pools keep CPU allocated for continuous polling. Until `temporal-gcp-cloud-run-id` is released
39-
a remote `--source` build cannot resolve it, so build the image locally against your SDK checkout and
38+
Worker pools keep CPU allocated between requests. Until `temporal-gcp-cloud-run-id` is released a
39+
remote `--source` build cannot resolve it, so build the image locally against your SDK checkout and
4040
deploy it by tag:
4141

4242
```bash
4343
export REGION=us-central1
44-
gcloud run worker-pools deploy cloud-run-worker-id \
45-
--image "$REGION-docker.pkg.dev/$PROJECT_ID/<repo>/cloud-run-worker-id:latest" \
44+
gcloud run worker-pools deploy cloud-run-id \
45+
--image "$REGION-docker.pkg.dev/$PROJECT_ID/<repo>/cloud-run-id:latest" \
4646
--region "$REGION" \
47-
--set-env-vars "TEMPORAL_ADDRESS=<addr>,TEMPORAL_NAMESPACE=<ns>,TEMPORAL_TASK_QUEUE=cloud-run-worker-id"
47+
--set-env-vars "TEMPORAL_ADDRESS=<addr>,TEMPORAL_NAMESPACE=<ns>,TEMPORAL_TASK_QUEUE=cloud-run-id"
4848
```
4949

5050
Each revision starts a fresh instance whose worker reports a distinct identity.
5151

5252
## Start a workflow
5353

5454
```bash
55-
temporal workflow start --type GreetingWorkflow --task-queue cloud-run-worker-id \
55+
temporal workflow start --type GreetingWorkflow --task-queue cloud-run-id \
5656
--workflow-id cloud-run-greeting --input '"Cloud Run"'
5757
```
5858

5959
The identity appears on the task-queue pollers (`temporal task-queue describe`) and recorded events.
60-
Delete the pool with `gcloud run worker-pools delete cloud-run-worker-id --region "$REGION"`.
60+
Delete the pool with `gcloud run worker-pools delete cloud-run-id --region "$REGION"`.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies {
1717
}
1818

1919
application {
20-
mainClass = 'io.temporal.samples.gcp.cloudrun.workerid.CloudRunWorker'
20+
mainClass = 'io.temporal.samples.gcp.cloudrun.id.CloudRunWorker'
2121
// Stable launcher name the Dockerfile relies on, independent of the Gradle project path.
22-
applicationName = 'cloud-run-worker-id'
22+
applicationName = 'cloud-run-id'
2323
}

gcp/cloud-run/workerid/src/main/java/io/temporal/samples/gcp/cloudrun/workerid/CloudRunWorker.java renamed to gcp/cloud-run/id/src/main/java/io/temporal/samples/gcp/cloudrun/id/CloudRunWorker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.temporal.samples.gcp.cloudrun.workerid;
1+
package io.temporal.samples.gcp.cloudrun.id;
22

33
import io.temporal.client.WorkflowClient;
44
import io.temporal.client.WorkflowClientOptions;
@@ -12,7 +12,7 @@
1212
import org.slf4j.Logger;
1313
import org.slf4j.LoggerFactory;
1414

15-
/** A continuously polling Temporal Worker for a Google Cloud Run worker pool. */
15+
/** A Temporal Worker for a Google Cloud Run worker pool. */
1616
public final class CloudRunWorker {
1717
private static final Logger logger = LoggerFactory.getLogger(CloudRunWorker.class);
1818

@@ -22,7 +22,7 @@ public final class CloudRunWorker {
2222

2323
static final String DEFAULT_ADDRESS = "127.0.0.1:7233";
2424
static final String DEFAULT_NAMESPACE = "default";
25-
static final String DEFAULT_TASK_QUEUE = "cloud-run-worker-id";
25+
static final String DEFAULT_TASK_QUEUE = "cloud-run-id";
2626

2727
private CloudRunWorker() {}
2828

@@ -60,7 +60,7 @@ public static void main(String[] args) {
6060
GoogleCloudRunMetadata.fetch().identity(),
6161
taskQueue);
6262

63-
// Cloud Run worker pools are continuous workloads, so keep the process alive until SIGTERM.
63+
// Keep the process alive until Cloud Run sends SIGTERM.
6464
factory.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
6565
}
6666

gcp/cloud-run/workerid/src/main/java/io/temporal/samples/gcp/cloudrun/workerid/GreetingActivities.java renamed to gcp/cloud-run/id/src/main/java/io/temporal/samples/gcp/cloudrun/id/GreetingActivities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.temporal.samples.gcp.cloudrun.workerid;
1+
package io.temporal.samples.gcp.cloudrun.id;
22

33
import io.temporal.activity.ActivityInterface;
44

gcp/cloud-run/workerid/src/main/java/io/temporal/samples/gcp/cloudrun/workerid/GreetingActivitiesImpl.java renamed to gcp/cloud-run/id/src/main/java/io/temporal/samples/gcp/cloudrun/id/GreetingActivitiesImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.temporal.samples.gcp.cloudrun.workerid;
1+
package io.temporal.samples.gcp.cloudrun.id;
22

33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;

gcp/cloud-run/workerid/src/main/java/io/temporal/samples/gcp/cloudrun/workerid/GreetingWorkflow.java renamed to gcp/cloud-run/id/src/main/java/io/temporal/samples/gcp/cloudrun/id/GreetingWorkflow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.temporal.samples.gcp.cloudrun.workerid;
1+
package io.temporal.samples.gcp.cloudrun.id;
22

33
import io.temporal.workflow.WorkflowInterface;
44
import io.temporal.workflow.WorkflowMethod;

gcp/cloud-run/workerid/src/main/java/io/temporal/samples/gcp/cloudrun/workerid/GreetingWorkflowImpl.java renamed to gcp/cloud-run/id/src/main/java/io/temporal/samples/gcp/cloudrun/id/GreetingWorkflowImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.temporal.samples.gcp.cloudrun.workerid;
1+
package io.temporal.samples.gcp.cloudrun.id;
22

33
import io.temporal.activity.ActivityOptions;
44
import io.temporal.workflow.Workflow;
File renamed without changes.

gcp/cloud-run/workerid/src/test/java/io/temporal/samples/gcp/cloudrun/workerid/GreetingWorkflowTest.java renamed to gcp/cloud-run/id/src/test/java/io/temporal/samples/gcp/cloudrun/id/GreetingWorkflowTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.temporal.samples.gcp.cloudrun.workerid;
1+
package io.temporal.samples.gcp.cloudrun.id;
22

33
import static org.junit.Assert.assertEquals;
44

0 commit comments

Comments
 (0)