We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d36c84 commit 0e23c43Copy full SHA for 0e23c43
1 file changed
hello_nexus/simple.py
@@ -0,0 +1,23 @@
1
+from datetime import timedelta
2
+
3
+import nexusrpc
4
+from temporalio import workflow
5
+from temporalio.workflow import NexusClient
6
7
8
+# TODO(dan): make this decorator usable without parens
9
+@nexusrpc.handler.service()
10
+class MyNexusService:
11
+ @nexusrpc.handler.sync_operation
12
+ async def my_op(self, input: str, _: nexusrpc.handler.StartOperationOptions) -> str:
13
+ return f"{input}-result"
14
15
16
+@workflow.run
17
+async def run(self, message: str) -> str:
18
+ nexus_client = NexusClient(
19
+ MyNexusService,
20
+ "my-endpoint",
21
+ schedule_to_close_timeout=timedelta(seconds=30),
22
+ )
23
+ return await nexus_client.execute_operation(MyNexusService.my_op, message)
0 commit comments