diff --git a/core/src/main/java/io/temporal/samples/nexusmessaging/callerpattern/README.md b/core/src/main/java/io/temporal/samples/nexusmessaging/callerpattern/README.md index b369a95f..5a7670ae 100644 --- a/core/src/main/java/io/temporal/samples/nexusmessaging/callerpattern/README.md +++ b/core/src/main/java/io/temporal/samples/nexusmessaging/callerpattern/README.md @@ -1,11 +1,11 @@ ## Caller pattern The handler worker starts a `GreetingWorkflow` for a User ID. -`NexusGreetingServiceImpl` holds that ID and routes every Nexus operation to it. +`NexusGreetingServiceImpl` derives the Workflow ID and routes every Nexus operation to it. The caller's input does not have that Workflow ID as the caller doesn't know it - but the caller sends in the User ID, -and `NexusGreetingServiceImpl` knows how to get the desired Workflow ID from that User ID (see the getWorkflowId call). +and `NexusGreetingServiceImpl` knows how to get the desired Workflow ID from that User ID (see the `getWorkflowId` call). -HandlerWorker is using the same getWorkflowId call to generate a Workflow ID from a User ID when it launches the Workflow. +`HandlerWorker` is using the same `getWorkflowId` call to generate a Workflow ID from a User ID when it launches the Workflow. The caller Workflow: 1. Queries for supported languages (`getLanguages` — backed by a `@QueryMethod`) diff --git a/core/src/main/java/io/temporal/samples/nexusmessaging/ondemandpattern/handler/NexusRemoteGreetingServiceImpl.java b/core/src/main/java/io/temporal/samples/nexusmessaging/ondemandpattern/handler/NexusRemoteGreetingServiceImpl.java index b7397987..068d8050 100644 --- a/core/src/main/java/io/temporal/samples/nexusmessaging/ondemandpattern/handler/NexusRemoteGreetingServiceImpl.java +++ b/core/src/main/java/io/temporal/samples/nexusmessaging/ondemandpattern/handler/NexusRemoteGreetingServiceImpl.java @@ -13,8 +13,9 @@ import org.slf4j.LoggerFactory; /** - * Nexus operation handler for the on-demand pattern. Each operation receives the target workflow ID - * in its input, and {@code runFromRemote} starts a brand-new GreetingWorkflow. + * Nexus operation handler for the on-demand pattern. Each operation receives a userId, which is + * mapped to a workflow ID using {@link #WORKFLOW_ID_PREFIX}, and {@code runFromRemote} starts a + * brand-new GreetingWorkflow. */ @ServiceImpl(service = NexusRemoteGreetingService.class) public class NexusRemoteGreetingServiceImpl { @@ -38,8 +39,8 @@ private GreetingWorkflow getWorkflowStub(String userId) { .newWorkflowStub(GreetingWorkflow.class, getWorkflowId(userId)); } - // Starts a new GreetingWorkflow with the caller-specified workflow ID. This is an async - // Nexus operation backed by WorkflowRunOperation. + // Starts a new GreetingWorkflow, using a workflow ID derived from the caller-supplied userId. + // This is an async Nexus operation backed by WorkflowRunOperation. @OperationImpl public OperationHandler runFromRemote() { return WorkflowRunOperation.fromWorkflowHandle( diff --git a/core/src/main/java/io/temporal/samples/nexusmessagingtemporaloperation/README.md b/core/src/main/java/io/temporal/samples/nexusmessagingtemporaloperation/README.md index f944dd4f..ec36fac9 100644 --- a/core/src/main/java/io/temporal/samples/nexusmessagingtemporaloperation/README.md +++ b/core/src/main/java/io/temporal/samples/nexusmessagingtemporaloperation/README.md @@ -1,6 +1,7 @@ This sample shows how to expose a long-running Workflow's queries, updates, and signals as Nexus operations. This version uses the experimental `@TemporalOperation` annotation to declare Temporal-backed Nexus operations as ordinary -methods on `@ServiceImpl` classes instead of `@OperationImpl` factories that return `TemporalOperationHandler.create(...)`. +methods on `@ServiceImpl` classes instead of `@OperationImpl` factories that return `OperationHandler.sync(...)` and +`WorkflowRunOperation.fromWorkflowHandle(...)`. There are two self-contained examples, each in its own directory: