Skip to content

Commit ccb9622

Browse files
chore: sync code snippets via snipsync (#5121)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5ee3251 commit ccb9622

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

docs/develop/php/activities/asynchronous-activity.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ There are two parts to implementing an asynchronously completed Activity:
8585
The following example demonstrates the first part:
8686

8787
<!--SNIPSTART samples-php-async-activity-completion-activity-class-->
88-
[app/src/AsyncActivityCompletion/GreetingActivity.php](https://github.com/temporalio/samples-php/blob/master/app/src/AsyncActivityCompletion/GreetingActivity.php)
88+
[app/src/AsyncActivityCompletion/GreetingActivity.php](https://github.com/temporalio/samples-php/blob/main/app/src/AsyncActivityCompletion/GreetingActivity.php)
8989
```php
9090
class GreetingActivity implements GreetingActivityInterface
9191
{
@@ -118,7 +118,7 @@ class GreetingActivity implements GreetingActivityInterface
118118
The following code demonstrates how to complete the Activity successfully using `WorkflowClient`:
119119

120120
<!--SNIPSTART samples-php-async-activity-completion-completebytoken-->
121-
[app/src/AsyncActivityCompletion/CompleteCommand.php](https://github.com/temporalio/samples-php/blob/master/app/src/AsyncActivityCompletion/CompleteCommand.php)
121+
[app/src/AsyncActivityCompletion/CompleteCommand.php](https://github.com/temporalio/samples-php/blob/main/app/src/AsyncActivityCompletion/CompleteCommand.php)
122122
```php
123123
$client = $this->workflowClient->newActivityCompletionClient();
124124
// Complete the Activity.

docs/develop/typescript/workers/run-process.mdx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,39 @@ Create a Worker with `Worker.create()`, passing a connection, the Task Queue to
2020
Call `run()` to start polling.
2121

2222
<!--SNIPSTART typescript-hello-worker-->
23-
[sleep-for-days/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/sleep-for-days/src/worker.ts)
23+
[hello-world/src/worker.ts](https://github.com/temporalio/samples-typescript/blob/main/hello-world/src/worker.ts)
2424
```ts
2525
import { NativeConnection, Worker } from '@temporalio/worker';
2626
import * as activities from './activities';
2727

2828
async function run() {
29+
// Step 1: Establish a connection with Temporal server.
30+
//
31+
// Worker code uses `@temporalio/worker.NativeConnection`.
32+
// (But in your application code it's `@temporalio/client.Connection`.)
2933
const connection = await NativeConnection.connect({
3034
address: 'localhost:7233',
35+
// TLS and gRPC metadata configuration goes here.
3136
});
3237
try {
38+
// Step 2: Register Workflows and Activities with the Worker.
3339
const worker = await Worker.create({
3440
connection,
3541
namespace: 'default',
36-
taskQueue: 'sleep-for-days',
42+
taskQueue: 'hello-world',
43+
// Workflows are registered using a path as they run in a separate JS context.
3744
workflowsPath: require.resolve('./workflows'),
3845
activities,
3946
});
47+
48+
// Step 3: Start accepting tasks on the `hello-world` queue
49+
//
50+
// The worker runs until it encounters an unexpected error or the process receives a shutdown signal registered on
51+
// the SDK Runtime object.
52+
//
53+
// By default, worker logs are written via the Runtime logger to STDERR at INFO level.
54+
//
55+
// See https://typescript.temporal.io/api/classes/worker.Runtime#install to customize these defaults.
4056
await worker.run();
4157
} finally {
4258
// Close the connection once the worker has stopped

0 commit comments

Comments
 (0)