1010from typing import Optional
1111
1212from nexusrpc .handler import (
13- StartOperationContext ,
1413 service_handler ,
1514)
1615from temporalio import nexus , workflow
1716from temporalio .client import Client
18- from temporalio .nexus import workflow_run_operation
17+ from temporalio .nexus import WorkflowRunOperationContext , workflow_run_operation
1918from temporalio .worker import UnsandboxedWorkflowRunner , Worker
2019from temporalio .workflow import NexusClient
2120
@@ -40,14 +39,14 @@ async def run(self, message: str) -> str:
4039@service_handler
4140class MyNexusService :
4241 # Here we implement a Nexus operation backed by a Temporal workflow. The start
43- # method must use nexus .start_workflow to start the workflow. (Temporal server will
44- # then take care of delivering the workflow result to the caller, using the Nexus
45- # RPC callback mechanism).
42+ # method must use WorkflowRunOperationContext .start_workflow to start the workflow.
43+ # (Temporal server will then take care of delivering the workflow result to the
44+ # caller, using the Nexus RPC callback mechanism).
4645 @workflow_run_operation
4746 async def my_workflow_run_operation (
48- self , ctx : StartOperationContext , name : str
47+ self , ctx : WorkflowRunOperationContext , name : str
4948 ) -> nexus .WorkflowHandle [str ]:
50- return await nexus .start_workflow (
49+ return await ctx .start_workflow (
5150 HandlerWorkflow .run ,
5251 name ,
5352 id = str (uuid .uuid4 ()),
0 commit comments