File tree Expand file tree Collapse file tree 11 files changed +57
-124
lines changed
core/src/main/java/io/temporal/samples Expand file tree Collapse file tree 11 files changed +57
-124
lines changed Original file line number Diff line number Diff line change 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+ ```
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .caller ;
20+ package io .temporal .samples .nexuscontextpropagation .caller ;
2121
2222import io .temporal .api .common .v1 .WorkflowExecution ;
2323import io .temporal .client .WorkflowClient ;
2727import io .temporal .samples .nexus .caller .HelloCallerWorkflow ;
2828import io .temporal .samples .nexus .options .ClientOptions ;
2929import io .temporal .samples .nexus .service .NexusService ;
30- import io .temporal .samples .nexuscontextpropogation .propogation .MDCContextPropagator ;
30+ import io .temporal .samples .nexuscontextpropagation .propogation .MDCContextPropagator ;
3131import java .util .Collections ;
3232import org .slf4j .Logger ;
3333import org .slf4j .LoggerFactory ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .caller ;
20+ package io .temporal .samples .nexuscontextpropagation .caller ;
2121
2222import io .temporal .client .WorkflowClient ;
2323import io .temporal .samples .nexus .options .ClientOptions ;
24- import io .temporal .samples .nexuscontextpropogation .propogation .NexusMDCContextInterceptor ;
24+ import io .temporal .samples .nexuscontextpropagation .propogation .NexusMDCContextInterceptor ;
2525import io .temporal .worker .Worker ;
2626import io .temporal .worker .WorkerFactory ;
2727import io .temporal .worker .WorkerFactoryOptions ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .caller ;
20+ package io .temporal .samples .nexuscontextpropagation .caller ;
2121
2222import io .temporal .samples .nexus .caller .EchoCallerWorkflow ;
2323import io .temporal .samples .nexus .service .NexusService ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .caller ;
20+ package io .temporal .samples .nexuscontextpropagation .caller ;
2121
2222import io .temporal .samples .nexus .caller .HelloCallerWorkflow ;
2323import io .temporal .samples .nexus .service .NexusService ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .handler ;
20+ package io .temporal .samples .nexuscontextpropagation .handler ;
2121
2222import io .temporal .client .WorkflowClient ;
2323import io .temporal .client .WorkflowClientOptions ;
2424import 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 ;
2727import io .temporal .worker .Worker ;
2828import io .temporal .worker .WorkerFactory ;
2929import io .temporal .worker .WorkerFactoryOptions ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .handler ;
20+ package io .temporal .samples .nexuscontextpropagation .handler ;
2121
2222import io .temporal .failure .ApplicationFailure ;
2323import io .temporal .samples .nexus .handler .HelloHandlerWorkflow ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .handler ;
20+ package io .temporal .samples .nexuscontextpropagation .handler ;
2121
2222import io .nexusrpc .handler .OperationHandler ;
2323import io .nexusrpc .handler .OperationImpl ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .propogation ;
20+ package io .temporal .samples .nexuscontextpropagation .propogation ;
2121
2222import io .temporal .api .common .v1 .Payload ;
2323import io .temporal .common .context .ContextPropagator ;
Original file line number Diff line number Diff line change 1717 * permissions and limitations under the License.
1818 */
1919
20- package io .temporal .samples .nexuscontextpropogation .propogation ;
20+ package io .temporal .samples .nexuscontextpropagation .propogation ;
2121
2222import io .nexusrpc .OperationException ;
2323import io .nexusrpc .handler .OperationContext ;
You can’t perform that action at this time.
0 commit comments