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
2 changes: 1 addition & 1 deletion exercises/debug-activity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ in the Workflow code, rather than in an Activity, since that is typically
not prone to failure and unlikely to affect whether the Workflow executes
in a deterministic manner. This exercise implemented it in the Activity,
since you can deploy a fix to Activity code without a risk of causing a
non-deterministic error. Later in this course, you'll learn how to safely
non-deterministic error. As you learned earlier in this course, there are also ways to safely
deploy changes to Workflow Definitions.

### This is the end of the exercise.
9 changes: 5 additions & 4 deletions exercises/durable-execution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ skip this step. An instance of the Microservice is already running in your
environment**

1. Navigate to the `utilities` directory at the root level of the course
2. Change directoryies into the `microservice directory`
2. Change directories into the `microservice directory`
1. `cd utilities/microservice`
3. Compile the microservice
1. `mvn clean compile`
Expand Down Expand Up @@ -89,9 +89,10 @@ Before proceeding, make sure that there are no Workers running for this or any p
1. If your using the GitPod environment, you can run `ex1w`
4. In another terminal, execute the Workflow by running `mvn exec:java -Dexec.mainClass="translationworkflow.Starter" -Dexec.args="Stanislav sk"` (replace `Stanislav` with your first name)
1. If your using the GitPod environment, you can run `ex1st "Stanislav sk`
5. Observe the output in the terminal windows used by each worker. 6. As soon as you see a log message in one of the Worker terminals indicating that it has started the Timer, locate the terminal with the message `[ACTIVITY INVOKED]...` and press Ctrl-C in _that_ window to kill that Worker process.
6. Switch to the terminal window for the other Worker process. Within a few seconds, you should observe new output, indicating that it has resumed execution of the Workflow.
7. Once you see log output indicating that translation was successful, switch back to the terminal window where you started the Workflow.
5. Observe the output in the terminal windows used by each worker.
6. As soon as you see a log message in one of the Worker terminals indicating that it has started the Timer, locate the terminal with the message `[ACTIVITY INVOKED]...` and press Ctrl-C in _that_ window to kill that Worker process.
7. Switch to the terminal window for the other Worker process. Within a few seconds, you should observe new output, indicating that it has resumed execution of the Workflow.
8. Once you see log output indicating that translation was successful, switch back to the terminal window where you started the Workflow.

After the final step, you should see the translated Hello and Goodbye messages, which confirms that Workflow Execution completed successfully despite the original Worker being killed.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package translationworkflow;

import java.net.HttpURLConnection;
import java.net.ProtocolException;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this was being used

import java.net.URI;
import java.net.URL;
import java.net.URLEncoder;
Expand All @@ -10,10 +9,7 @@
import java.io.IOException;
import io.temporal.activity.Activity;
import io.temporal.failure.ApplicationFailure;
import java.net.HttpURLConnection;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this was being used


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Comment on lines -15 to -16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step B2 in the readme is to add these imports, so I think we want to remove them from the code 👍

import translationworkflow.model.TranslationActivityInput;
import translationworkflow.model.TranslationActivityOutput;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public TranslationWorkflowOutput sayHelloGoodbye(TranslationWorkflowInput input)

// TODO: Add a log statement here at the debug level stating that the Activity is going
// to be invoked. Be sure to include the word being translated and the language code.

TranslationActivityInput goodbyeInput = new TranslationActivityInput("goodbye", languageCode);
TranslationActivityOutput goodbyeResult = activities.translateTerm(goodbyeInput);
String goodbyeMessage = goodbyeResult.getTranslation() + ", " + name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package translationworkflow;

import java.net.HttpURLConnection;
import java.net.ProtocolException;
import java.net.URI;
import java.net.URL;
import java.net.URLEncoder;
Expand All @@ -10,7 +9,6 @@
import java.io.IOException;
import io.temporal.activity.Activity;
import io.temporal.failure.ApplicationFailure;
import java.net.HttpURLConnection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
9 changes: 5 additions & 4 deletions exercises/testing-code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ translates the term "Hello" to German. Take a moment to study the
test, which you'll find in the `TranslationActivitiesTest.java` file in the
`src/test/java/translationworkflow` directory. Since the test runs the
Activity, which in turn calls the microservice to do the translation, ensure
that your microservice is running as state above. Then run the test.
that your microservice is running as stated above. Then run the test.

1. Run the `mvn test` command to execute the provided test
1. `cd` into `exercises/testing-code/practice/`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to cd in. not sure if we have already written that somewhere or if we assume the user can figure that out 👍

2. Run the `mvn test` command to execute the provided test

## Part B: Write and Run Another Test for the Activity

Expand Down Expand Up @@ -107,8 +108,8 @@ following steps:
1. Edit the `TranslationWorkflowTest.java` file in the
`src/test/java/translationworkflow` directory
2. Add assertions for the following conditions to the `testSuccessfulTranslation` test
- The `helloMessage` field in the result is `Bonjour, Pierre`
- The `goodbyeMessage` field in the result is `Au revoir, Pierre`
- The `helloMessage` field in the output is `Bonjour, Pierre`
- The `goodbyeMessage` field in the output is `Au revoir, Pierre`
Comment on lines -110 to +112
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable is named output

3. Save your changes
4. Run `mvn test`. This will fail, due to a bug in the Workflow Definition.
5. Find and fix the bug in the Workflow Definition
Expand Down