forked from temporalio/samples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.py
More file actions
34 lines (23 loc) · 1012 Bytes
/
service.py
File metadata and controls
34 lines (23 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
This is a Nexus service definition that demonstrates multiple argument handling.
A service definition defines a Nexus service as a named collection of operations, each
with input and output types. It does not implement operation handling: see the service
handler and operation handlers in nexus_multiple_args.handler.service_handler for that.
A Nexus service definition is used by Nexus callers (e.g. a Temporal workflow) to create
type-safe clients, and it is used by Nexus handlers to validate that they implement
correctly-named operation handlers with the correct input and output types.
The service defined in this file features one operation: hello, where hello
demonstrates handling multiple arguments through a single input object.
"""
from dataclasses import dataclass
import nexusrpc
@dataclass
class HelloInput:
name: str
language: str
@dataclass
class HelloOutput:
message: str
@nexusrpc.service
class MyNexusService:
hello: nexusrpc.Operation[HelloInput, HelloOutput]