Skip to content

Commit 6bc4733

Browse files
committed
Restore separate namespaces for the Nexus caller and handlers
Keep each handler in its own namespace using descriptive encoding names. Update local setup commands, the namespace table, and caller test context.
1 parent e2e8ca8 commit 6bc4733

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

  • core/src
    • main/java/io/temporal/samples/nexusserializationcontext
    • test/java/io/temporal/samples/nexusserializationcontext/codec

‎core/src/main/java/io/temporal/samples/nexusserializationcontext/README.md‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ through four endpoints. `CompressedEncryptedHandlerWorker` compresses and then
66
encrypts Nexus payloads. `EncryptedHandlerWorker` encrypts without
77
compression. Each handler selects between its own key 1 and key 2 using
88
the endpoint in the Nexus context.
9+
The caller and each handler run in separate namespaces.
910

1011
| Endpoint | Encryption key | Nexus payload encoding |
1112
|---|---|---|
@@ -73,56 +74,66 @@ Keep this prerelease binary separate from your stable CLI. The commands below us
7374

7475
## Run locally
7576

76-
The caller and both handlers share the `nexus-serialization` namespace. Each worker
77-
polls its own task queue; both endpoints for a handler target that handler's queue.
77+
The caller and each handler use separate namespaces. Each worker polls a task queue
78+
with the same name as its namespace. Both endpoints for a handler target that handler's
79+
namespace and task queue.
80+
81+
| Worker | Namespace and task queue |
82+
|---|---|
83+
| Caller | `nexus-serialization-caller` |
84+
| Compressed/encrypted handler | `nexus-serialization-compressed-encrypted-handler` |
85+
| Encrypted handler | `nexus-serialization-encrypted-handler` |
7886

7987
Start the dev server:
8088

8189
```bash
82-
./temporal server start-dev --namespace nexus-serialization
90+
./temporal server start-dev \
91+
--namespace nexus-serialization-caller \
92+
--namespace nexus-serialization-compressed-encrypted-handler \
93+
--namespace nexus-serialization-encrypted-handler
8394
```
8495

8596
Create two endpoints for each handler worker:
8697

8798
```bash
8899
./temporal operator nexus endpoint create \
89100
--name nexus-serialization-compressed-encrypted-1 \
90-
--target-namespace nexus-serialization \
101+
--target-namespace nexus-serialization-compressed-encrypted-handler \
91102
--target-task-queue nexus-serialization-compressed-encrypted-handler
92103
./temporal operator nexus endpoint create \
93104
--name nexus-serialization-compressed-encrypted-2 \
94-
--target-namespace nexus-serialization \
105+
--target-namespace nexus-serialization-compressed-encrypted-handler \
95106
--target-task-queue nexus-serialization-compressed-encrypted-handler
96107
./temporal operator nexus endpoint create \
97108
--name nexus-serialization-encrypted-1 \
98-
--target-namespace nexus-serialization \
109+
--target-namespace nexus-serialization-encrypted-handler \
99110
--target-task-queue nexus-serialization-encrypted-handler
100111
./temporal operator nexus endpoint create \
101112
--name nexus-serialization-encrypted-2 \
102-
--target-namespace nexus-serialization \
113+
--target-namespace nexus-serialization-encrypted-handler \
103114
--target-task-queue nexus-serialization-encrypted-handler
104115
```
105116

106117
Run each of the following in its own terminal from the repository root:
107118

108119
```bash
109120
./gradlew -q :core:execute -PmainClass=io.temporal.samples.nexusserializationcontext.handler.CompressedEncryptedHandlerWorker \
110-
--args="-namespace nexus-serialization"
121+
--args="-namespace nexus-serialization-compressed-encrypted-handler"
111122
```
112123

113124
```bash
114125
./gradlew -q :core:execute -PmainClass=io.temporal.samples.nexusserializationcontext.handler.EncryptedHandlerWorker \
115-
--args="-namespace nexus-serialization"
126+
--args="-namespace nexus-serialization-encrypted-handler"
116127
```
117128

118129
```bash
119130
./gradlew -q :core:execute -PmainClass=io.temporal.samples.nexusserializationcontext.caller.CallerWorker \
120-
--args="-namespace nexus-serialization"
131+
--args="-namespace nexus-serialization-caller"
121132
```
122133

123134
```bash
124135
./gradlew -q :core:execute -PmainClass=io.temporal.samples.nexusserializationcontext.caller.CallerStarter \
125-
--args="-namespace nexus-serialization"
136+
--args="-namespace nexus-serialization-caller"
126137
```
127138

128139
The starter prints a sync result and an async result for each endpoint. All eight

‎core/src/test/java/io/temporal/samples/nexusserializationcontext/codec/NexusCodecTest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ void compressesBeforeEncryptingWithEitherKey() {
5151
void callerWorkflowPayloadsUseTheirOwnKey() {
5252
DataConverter converter =
5353
CallerWorker.dataConverter()
54-
.withContext(new WorkflowSerializationContext("nexus-serialization", "caller-id"));
54+
.withContext(
55+
new WorkflowSerializationContext("nexus-serialization-caller", "caller-id"));
5556
EndpointResults results =
5657
new EndpointResults(
5758
"reply compressed-encrypted-1",

0 commit comments

Comments
 (0)