Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nexus_messaging/ondemandpattern/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ operations. `NexusRemoteGreetingService` adds a `run_from_remote` operation that
instance to target.

The caller Workflow:
1. Starts two remote `GreetingWorkflow` instances via `run_from_remote` (backed by `workflow_run_operation`)
1. Starts two remote `GreetingWorkflow` instances via `run_from_remote` (backed by `temporal_operation`)
2. Queries each for supported languages
3. Changes the language on each (Arabic and Hindi)
4. Confirms the changes via queries
Expand Down
2 changes: 1 addition & 1 deletion nexus_messaging/ondemandpattern/caller/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def run(self) -> list[str]:

# This is an async Nexus operation -- starts a workflow on the handler and
# returns a handle. Unlike the sync operations below, this does not block
# until the workflow completes. It is backed by workflow_run_operation on the
# until the workflow completes. It is backed by temporal_operation on the
# handler side.
handle_one = await self.nexus_client.start_operation(
NexusRemoteGreetingService.run_from_remote,
Expand Down
13 changes: 8 additions & 5 deletions nexus_messaging/ondemandpattern/handler/service_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ def _get_workflow_handle(
)

# Starts a new GreetingWorkflow with the caller-specified user ID.
# This is an async Nexus operation backed by workflow_run_operation.
@nexus.workflow_run_operation
# This is an async Nexus operation backed by temporal_operation.
@nexus.temporal_operation
async def run_from_remote(
self, ctx: nexus.WorkflowRunOperationContext, input: RunFromRemoteInput
) -> nexus.WorkflowHandle[str]:
return await ctx.start_workflow(
self,
_ctx: nexus.TemporalStartOperationContext,
client: nexus.TemporalNexusClient,
input: RunFromRemoteInput,
) -> nexus.TemporalOperationResult[str]:
return await client.start_workflow(
GreetingWorkflow.run,
id=self._get_workflow_id(input.user_id),
)
Expand Down
Loading