Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions exercises/hello-workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ Once the project has been downloaded, you will see some suggestions for how to b

## Part B: Review the Workflow Business Logic

1. Open the `practice/src/activities.ts` file in the editor and review the business logic.
2. Open the `practice/src/workflows.ts` file in the editor and review the `greet` constant. Take special care to look at the Start-to-Close Timeout option.

1. Open the `workflows.ts` file (located in the `practice` subdirectory) in the editor.
2. Review the input parameters, business logic, and return value.

## Part C: Change the Task Queue Name for the Worker

Expand All @@ -68,8 +67,7 @@ npm run start.watch
npm run workflow
```

This command starts the Workflow, shows the Workflow's unique identifer, and prints the result of the `greeting` Activity.

This command starts the Workflow and prints the result.

If you have time, continue with the optional part of the exercise below to see how to view the result using `temporal`.

Expand All @@ -83,5 +81,4 @@ This command shows you a lot of information. We will cover this output later in

It is also possible, and often more convenient, to view this information using the Web UI. You will have a chance to do this in the next exercise.


### This is the end of the exercise.
### This is the end of the exercise.
Binary file not shown.
3 changes: 0 additions & 3 deletions exercises/hello-workflow/practice/src/activities.ts

This file was deleted.

2 changes: 0 additions & 2 deletions exercises/hello-workflow/practice/src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NativeConnection, Worker } from '@temporalio/worker';
import * as activities from './activities';

async function run() {
// Step 1: Establish a connection with Temporal server.
Expand All @@ -17,7 +16,6 @@ async function run() {
taskQueue: 'hello-world',
// Workflows are registered using a path as they run in a separate JS context.
workflowsPath: require.resolve('./workflows'),
activities,
});

// Step 3: Start accepting tasks on the `greeting-tasks` queue
Expand Down
12 changes: 2 additions & 10 deletions exercises/hello-workflow/practice/src/workflows.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import * as workflow from '@temporalio/workflow';
// Only import the activity types
import type * as activities from './activities';

const { greet } = workflow.proxyActivities<typeof activities>({
startToCloseTimeout: '1 minute',
});

/** A workflow that simply calls an activity */
export async function example(name: string): Promise<string> {
return await greet(name);
}
return `Hello, ${name}!`;
}
3 changes: 0 additions & 3 deletions exercises/hello-workflow/solution/src/activities.ts

This file was deleted.

2 changes: 0 additions & 2 deletions exercises/hello-workflow/solution/src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Worker } from '@temporalio/worker';
import * as activities from './activities';

async function run() {
// Step 1: Register Workflows and Activities with the Worker and connect to
// the Temporal server.
const worker = await Worker.create({
workflowsPath: require.resolve('./workflows'),
activities,
taskQueue: 'greeting-tasks',
});
// Worker connects to localhost by default and uses console.error for logging.
Expand Down
12 changes: 2 additions & 10 deletions exercises/hello-workflow/solution/src/workflows.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import { proxyActivities } from '@temporalio/workflow';
// Only import the activity types
import type * as activities from './activities';

const { greet } = proxyActivities<typeof activities>({
startToCloseTimeout: '1 minute',
});

/** A workflow that simply calls an activity */
export async function example(name: string): Promise<string> {
return await greet(name);
}
return `Hello, ${name}!`;
}