File tree Expand file tree Collapse file tree
without_service_definition Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from temporalio import workflow
2- from temporalio .workflow import NexusServiceClient
2+ from temporalio .workflow import NexusClient
33
44from hello_nexus .basic .service import MyInput , MyNexusService , MyOutput
55
99@workflow .defn
1010class CallerWorkflow :
1111 def __init__ (self ):
12- self .nexus_service_client = NexusServiceClient (
12+ self .nexus_client = NexusClient (
1313 MyNexusService ,
1414 endpoint = NEXUS_ENDPOINT ,
1515 )
1616
1717 @workflow .run
1818 async def run (self , name : str ) -> tuple [MyOutput , MyOutput ]:
19- sync_result : MyOutput = await self .nexus_service_client .execute_operation (
19+ sync_result : MyOutput = await self .nexus_client .execute_operation (
2020 MyNexusService .my_sync_operation ,
2121 MyInput (name ),
2222 )
23- wf_result : MyOutput = await self .nexus_service_client .execute_operation (
23+ wf_result : MyOutput = await self .nexus_client .execute_operation (
2424 MyNexusService .my_workflow_run_operation ,
2525 MyInput (name ),
2626 )
Original file line number Diff line number Diff line change 1515from temporalio import workflow
1616from temporalio .client import Client
1717from temporalio .worker import UnsandboxedWorkflowRunner , Worker
18- from temporalio .workflow import NexusServiceClient
18+ from temporalio .workflow import NexusClient
1919
2020NAMESPACE = "my-namespace"
2121TASK_QUEUE = "my-task-queue"
@@ -41,10 +41,8 @@ async def run(self, message: str) -> str:
4141 # Normally, the first argument to both these calls would reference a service
4242 # contract class, but it can also reference your service handler class, as here.
4343
44- nexus_service = NexusServiceClient (
45- MyNexusServiceHandler , endpoint = NEXUS_ENDPOINT
46- )
47- return await nexus_service .execute_operation (
44+ nexus_client = NexusClient (MyNexusServiceHandler , endpoint = NEXUS_ENDPOINT )
45+ return await nexus_client .execute_operation (
4846 MyNexusServiceHandler .my_sync_operation , message
4947 )
5048
You can’t perform that action at this time.
0 commit comments