|
1 | | -### Steps to run this sample: |
2 | | -1) Run a [Temporal service](https://github.com/temporalio/samples-go/tree/main/#how-to-use). |
3 | | -2) Run the following command to start the worker |
| 1 | +### Steps to run this sample (with expected output): |
| 2 | +1) Run a [Temporal server](https://github.com/temporalio/samples-go/tree/main/#how-to-use). (If you are going to run locally, you will want to start it in another terminal; this command is blocking and runs until it receives a SIGINT (Ctrl + C) command.) |
| 3 | + |
| 4 | + |
| 5 | +If you used the above instructions to start the server, you should see a line about the CLI, Server and UI versions, and one line each for the Server URL, UI URL and Metrics endpoint. It should look something like this: |
| 6 | + |
| 7 | +```bash |
| 8 | +> temporal server start-dev |
| 9 | +CLI 1.5.1 (Server 1.29.1, UI 2.42.1) |
| 10 | + |
| 11 | +Server: localhost:7233 |
| 12 | +UI: http://localhost:8233 |
| 13 | +Metrics: http://localhost:57058/metrics |
4 | 14 | ``` |
| 15 | + |
| 16 | +2) Open a second terminal, and run the following command to start the worker. The worker is a blocking process that runs until it receives a SIGINT (Ctrl + C) command. |
| 17 | +```bash |
5 | 18 | go run helloworld/worker/main.go |
6 | 19 | ``` |
7 | | -3) Run the following command to start the example |
| 20 | + |
| 21 | +You should see two console log lines: |
| 22 | + 1. Creating the logger |
| 23 | + 2. Starting the Worker with Namespace `default`, and TaskQueue `hello-world` and it will list the WorkerID for the created worker. |
| 24 | + |
| 25 | +For example: |
| 26 | +```bash |
| 27 | +2025/12/22 15:00:15 INFO No logger configured for temporal client. Created default one. |
| 28 | + |
| 29 | +2025/12/22 15:00:16 INFO Started Worker Namespace default TaskQueue hello-world WorkerID 82087 |
8 | 30 | ``` |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> Timestamps and IDs will differ on your machine. |
| 34 | +
|
| 35 | +3) In a third terminal, run the following command to start the example |
| 36 | +```bash |
9 | 37 | go run helloworld/starter/main.go |
10 | 38 | ``` |
| 39 | + |
| 40 | +You should see three console log lines: 1) Creating the logger, 2) Starting the workflow, and 3) The workflow result. |
| 41 | + |
| 42 | +For example: |
| 43 | +```bash |
| 44 | +2025/12/22 15:07:24 INFO No logger configured for temporal client. Created default one. |
| 45 | + |
| 46 | +2025/12/22 15:07:25 Started workflow WorkflowID hello_world_workflowID RunID 019b47ac-7c4d-701f-9d35-3acfe171723e |
| 47 | + |
| 48 | +2025/12/22 15:07:25 Workflow result: Hello Temporal! |
| 49 | +``` |
| 50 | + |
| 51 | +## Troubleshooting |
| 52 | + |
| 53 | +> [!NOTE] |
| 54 | +> This sample relies on the existence of the `default` namespace. If you are a Temporal contributor and built the server locally using [these instructions](https://github.com/temporalio/temporal/blob/main/CONTRIBUTING.md) instead of the dev server in step 1, the `default` namespace is not created automatically. You will need to create it using the instructions below or you will get an error message when starting the worker: `Unable to start worker Namespace default is not found.` |
| 55 | +> |
| 56 | +>Confirm that the `default` namespace exists using this command: |
| 57 | +> |
| 58 | +>```bash |
| 59 | +>temporal operator namespace list |
| 60 | +>``` |
| 61 | +>You should see a line with `NamespaceInfo.Name` set to `default`. |
| 62 | +> |
| 63 | +>If you do not find a namespace named `default`, you can create it here using this command: |
| 64 | +> |
| 65 | +>```bash |
| 66 | +>temporal operator namespace create -n default |
| 67 | +>``` |
0 commit comments