|
1 | | -# Nexus |
| 1 | +This sample shows how to define a Nexus service, implement the operation handlers, and |
| 2 | +call the operations from a workflow. |
2 | 3 |
|
3 | | -Temporal Nexus is a feature of the Temporal platform designed to connect durable executions across team, namespace, |
4 | | -region, and cloud boundaries. It promotes a more modular architecture for sharing a subset of your team’s capabilities |
5 | | -via well-defined service API contracts for other teams to use. These can abstract underlying Temporal primitives such as |
6 | | -Workflows, or execute arbitrary code. |
| 4 | +### Sample directory structure |
7 | 5 |
|
8 | | -Learn more at [temporal.io/nexus](https://temporal.io/nexus). |
| 6 | +- [service.py](./service.py) - shared Nexus service definition |
| 7 | +- [caller](./caller) - a caller workflow that executes Nexus operations, together with a worker and starter code |
| 8 | +- [handler](./handler) - Nexus operation handlers, together with a workflow used by one of the Nexus operations, and a worker that polls for both workflow and Nexus tasks. |
9 | 9 |
|
10 | | -The samples in this directory form an introduction to Nexus. |
11 | 10 |
|
12 | | -### Samples |
| 11 | +### Instructions |
13 | 12 |
|
14 | | -- [basic](./basic) - Nexus service definition, operation handlers, and calling workflows. |
| 13 | +Start a Temporal server. (See the main samples repo [README](../README.md)). |
| 14 | + |
| 15 | +Run the following: |
| 16 | + |
| 17 | +``` |
| 18 | +temporal operator namespace create --namespace hello-nexus-basic-handler-namespace |
| 19 | +temporal operator namespace create --namespace hello-nexus-basic-caller-namespace |
| 20 | +
|
| 21 | +temporal operator nexus endpoint create \ |
| 22 | + --name hello-nexus-basic-nexus-endpoint \ |
| 23 | + --target-namespace hello-nexus-basic-handler-namespace \ |
| 24 | + --target-task-queue my-handler-task-queue \ |
| 25 | + --description-file endpoint_description.md |
| 26 | +``` |
| 27 | + |
| 28 | +In one terminal, in this directory, run the Temporal worker in the handler namespace: |
| 29 | +``` |
| 30 | +uv run handler/worker.py |
| 31 | +``` |
| 32 | + |
| 33 | +In another terminal, in this directory, run the Temporal worker in the caller namespace and start the caller |
| 34 | +workflow: |
| 35 | +``` |
| 36 | +uv run caller/app.py |
| 37 | +``` |
0 commit comments