File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from temporalio .workflow import NexusClient
66
77
8- # TODO(dan): make this decorator usable without parens
9- @nexusrpc .handler .service ()
8+ @nexusrpc .handler .service
109class MyNexusService :
1110 @nexusrpc .handler .sync_operation
1211 async def my_op (self , input : str , _ : nexusrpc .handler .StartOperationOptions ) -> str :
1312 return f"{ input } -result"
1413
1514
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 )
15+ @workflow .defn
16+ class Workflow :
17+ @workflow .run
18+ async def run (self , message : str ) -> str :
19+ nexus_client = NexusClient (
20+ MyNexusService ,
21+ "my-endpoint" ,
22+ schedule_to_close_timeout = timedelta (seconds = 30 ),
23+ )
24+ return await nexus_client .execute_operation (MyNexusService .my_op , message )
You can’t perform that action at this time.
0 commit comments