Skip to content

Commit 3e22f85

Browse files
Updating Nexus Messaging start_workflow example
1 parent a9cb676 commit 3e22f85

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

nexus_messaging/ondemandpattern/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ operations. `NexusRemoteGreetingService` adds a `run_from_remote` operation that
66
instance to target.
77

88
The caller Workflow:
9-
1. Starts two remote `GreetingWorkflow` instances via `run_from_remote` (backed by `workflow_run_operation`)
9+
1. Starts two remote `GreetingWorkflow` instances via `run_from_remote` (backed by `temporal_operation`)
1010
2. Queries each for supported languages
1111
3. Changes the language on each (Arabic and Hindi)
1212
4. Confirms the changes via queries

nexus_messaging/ondemandpattern/caller/workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def run(self) -> list[str]:
4040

4141
# This is an async Nexus operation -- starts a workflow on the handler and
4242
# returns a handle. Unlike the sync operations below, this does not block
43-
# until the workflow completes. It is backed by workflow_run_operation on the
43+
# until the workflow completes. It is backed by temporal_operation on the
4444
# handler side.
4545
handle_one = await self.nexus_client.start_operation(
4646
NexusRemoteGreetingService.run_from_remote,

nexus_messaging/ondemandpattern/handler/service_handler.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ def _get_workflow_handle(
4040
)
4141

4242
# Starts a new GreetingWorkflow with the caller-specified user ID.
43-
# This is an async Nexus operation backed by workflow_run_operation.
44-
@nexus.workflow_run_operation
43+
# This is an async Nexus operation backed by temporal_operation.
44+
@nexus.temporal_operation
4545
async def run_from_remote(
46-
self, ctx: nexus.WorkflowRunOperationContext, input: RunFromRemoteInput
47-
) -> nexus.WorkflowHandle[str]:
48-
return await ctx.start_workflow(
46+
self,
47+
_ctx: nexus.TemporalStartOperationContext,
48+
client: nexus.TemporalNexusClient,
49+
input: RunFromRemoteInput,
50+
) -> nexus.TemporalOperationResult[str]:
51+
return await client.start_workflow(
4952
GreetingWorkflow.run,
5053
id=self._get_workflow_id(input.user_id),
5154
)

0 commit comments

Comments
 (0)