Skip to content

Commit 034a87e

Browse files
update readme
1 parent e8a6c1d commit 034a87e

File tree

11 files changed

+57
-124
lines changed

11 files changed

+57
-124
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Nexus Context Propagation
2+
3+
This sample shows how to propagate MDC context values from Workflows to Nexus operations.
4+
5+
From more details on Nexus and how to setup to run this samples please see the [Nexus Sample](../nexus/README.MD).
6+
7+
In separate terminal windows:
8+
9+
### Nexus handler worker
10+
11+
```
12+
./gradlew -q execute -PmainClass=io.temporal.samples.nexuscontextpropagation.handler.HandlerWorker \
13+
--args="-target-host localhost:7233 -namespace my-target-namespace"
14+
```
15+
16+
### Nexus caller worker
17+
18+
```
19+
./gradlew -q execute -PmainClass=io.temporal.samples.nexuscontextpropagation.caller.CallerWorker \
20+
--args="-target-host localhost:7233 -namespace my-caller-namespace"
21+
```
22+
23+
### Start caller workflow
24+
25+
```
26+
./gradlew -q execute -PmainClass=io.temporal.samples.nexuscontextpropagation.caller.CallerStarter \
27+
--args="-target-host localhost:7233 -namespace my-caller-namespace"
28+
```
29+
30+
### Output
31+
32+
which should result in this on the caller side:
33+
```
34+
INFO i.t.s.n.caller.CallerStarter - Started EchoCallerWorkflow workflowId: 7ac97cb9-b457-4052-af94-d82478c35c5e runId: 01954eb9-6963-7b52-9a1d-b74e64643846
35+
INFO i.t.s.n.caller.CallerStarter - Workflow result: Nexus Echo 👋
36+
INFO i.t.s.n.caller.CallerStarter - Started HelloCallerWorkflow workflowId: 9e0bc89c-5709-4742-b7c0-868464c2fccf runId: 01954eb9-6ae3-7d6d-b355-71545688309d
37+
INFO i.t.s.n.caller.CallerStarter - Workflow result: Hello Nexus 👋
38+
```
39+
40+
And this on the handler side:
41+
```
42+
INFO i.t.s.n.handler.NexusServiceImpl - Echo called from a workflow with ID : 7ac97cb9-b457-4052-af94-d82478c35c5e
43+
INFO i.t.s.n.h.HelloHandlerWorkflowImpl - HelloHandlerWorkflow called from a workflow with ID : 9e0bc89c-5709-4742-b7c0-868464c2fccf
44+
```

core/src/main/java/io/temporal/samples/nexuscontextpropogation/caller/CallerStarter.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/caller/CallerStarter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.caller;
20+
package io.temporal.samples.nexuscontextpropagation.caller;
2121

2222
import io.temporal.api.common.v1.WorkflowExecution;
2323
import io.temporal.client.WorkflowClient;
@@ -27,7 +27,7 @@
2727
import io.temporal.samples.nexus.caller.HelloCallerWorkflow;
2828
import io.temporal.samples.nexus.options.ClientOptions;
2929
import io.temporal.samples.nexus.service.NexusService;
30-
import io.temporal.samples.nexuscontextpropogation.propogation.MDCContextPropagator;
30+
import io.temporal.samples.nexuscontextpropagation.propogation.MDCContextPropagator;
3131
import java.util.Collections;
3232
import org.slf4j.Logger;
3333
import org.slf4j.LoggerFactory;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/caller/CallerWorker.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/caller/CallerWorker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.caller;
20+
package io.temporal.samples.nexuscontextpropagation.caller;
2121

2222
import io.temporal.client.WorkflowClient;
2323
import io.temporal.samples.nexus.options.ClientOptions;
24-
import io.temporal.samples.nexuscontextpropogation.propogation.NexusMDCContextInterceptor;
24+
import io.temporal.samples.nexuscontextpropagation.propogation.NexusMDCContextInterceptor;
2525
import io.temporal.worker.Worker;
2626
import io.temporal.worker.WorkerFactory;
2727
import io.temporal.worker.WorkerFactoryOptions;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/caller/EchoCallerWorkflowImpl.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/caller/EchoCallerWorkflowImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.caller;
20+
package io.temporal.samples.nexuscontextpropagation.caller;
2121

2222
import io.temporal.samples.nexus.caller.EchoCallerWorkflow;
2323
import io.temporal.samples.nexus.service.NexusService;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/caller/HelloCallerWorkflowImpl.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/caller/HelloCallerWorkflowImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.caller;
20+
package io.temporal.samples.nexuscontextpropagation.caller;
2121

2222
import io.temporal.samples.nexus.caller.HelloCallerWorkflow;
2323
import io.temporal.samples.nexus.service.NexusService;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/handler/HandlerWorker.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/handler/HandlerWorker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.handler;
20+
package io.temporal.samples.nexuscontextpropagation.handler;
2121

2222
import io.temporal.client.WorkflowClient;
2323
import io.temporal.client.WorkflowClientOptions;
2424
import io.temporal.samples.nexus.options.ClientOptions;
25-
import io.temporal.samples.nexuscontextpropogation.propogation.MDCContextPropagator;
26-
import io.temporal.samples.nexuscontextpropogation.propogation.NexusMDCContextInterceptor;
25+
import io.temporal.samples.nexuscontextpropagation.propogation.MDCContextPropagator;
26+
import io.temporal.samples.nexuscontextpropagation.propogation.NexusMDCContextInterceptor;
2727
import io.temporal.worker.Worker;
2828
import io.temporal.worker.WorkerFactory;
2929
import io.temporal.worker.WorkerFactoryOptions;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/handler/HelloHandlerWorkflowImpl.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/handler/HelloHandlerWorkflowImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.handler;
20+
package io.temporal.samples.nexuscontextpropagation.handler;
2121

2222
import io.temporal.failure.ApplicationFailure;
2323
import io.temporal.samples.nexus.handler.HelloHandlerWorkflow;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/handler/NexusServiceImpl.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/handler/NexusServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.handler;
20+
package io.temporal.samples.nexuscontextpropagation.handler;
2121

2222
import io.nexusrpc.handler.OperationHandler;
2323
import io.nexusrpc.handler.OperationImpl;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/propogation/MDCContextPropagator.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/propogation/MDCContextPropagator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.propogation;
20+
package io.temporal.samples.nexuscontextpropagation.propogation;
2121

2222
import io.temporal.api.common.v1.Payload;
2323
import io.temporal.common.context.ContextPropagator;

core/src/main/java/io/temporal/samples/nexuscontextpropogation/propogation/NexusMDCContextInterceptor.java renamed to core/src/main/java/io/temporal/samples/nexuscontextpropagation/propogation/NexusMDCContextInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* permissions and limitations under the License.
1818
*/
1919

20-
package io.temporal.samples.nexuscontextpropogation.propogation;
20+
package io.temporal.samples.nexuscontextpropagation.propogation;
2121

2222
import io.nexusrpc.OperationException;
2323
import io.nexusrpc.handler.OperationContext;

0 commit comments

Comments
 (0)