Skip to content

Commit dfeaf89

Browse files
committed
Rename: NexusClient
1 parent 38bad64 commit dfeaf89

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

hello_nexus/basic/caller/workflows.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from temporalio import workflow
2-
from temporalio.workflow import NexusServiceClient
2+
from temporalio.workflow import NexusClient
33

44
from hello_nexus.basic.service import MyInput, MyNexusService, MyOutput
55

@@ -9,18 +9,18 @@
99
@workflow.defn
1010
class 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
)

hello_nexus/without_service_definition/app.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from temporalio import workflow
1616
from temporalio.client import Client
1717
from temporalio.worker import UnsandboxedWorkflowRunner, Worker
18-
from temporalio.workflow import NexusServiceClient
18+
from temporalio.workflow import NexusClient
1919

2020
NAMESPACE = "my-namespace"
2121
TASK_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

0 commit comments

Comments
 (0)