diff --git a/docs/getting_started/dotnet/first_program_in_dotnet/index.md b/docs/getting_started/dotnet/first_program_in_dotnet/index.md index d784d778..cc97245d 100644 --- a/docs/getting_started/dotnet/first_program_in_dotnet/index.md +++ b/docs/getting_started/dotnet/first_program_in_dotnet/index.md @@ -151,7 +151,7 @@ public class MoneyTransferWorkflow InitialInterval = TimeSpan.FromSeconds(1), MaximumInterval = TimeSpan.FromSeconds(100), BackoffCoefficient = 2, - MaximumAttempts = 500, + MaximumAttempts = 3, NonRetryableErrorTypes = new[] { "InvalidAccountException", "InsufficientFundsException" } }; @@ -178,7 +178,7 @@ public class MoneyTransferWorkflow // If everything succeeds, return transfer complete return $"Transfer complete (transaction IDs: {withdrawResult}, {depositResult})"; } - catch (ApplicationFailureException depositEx) + catch (Exception depositEx) { try { @@ -188,9 +188,9 @@ public class MoneyTransferWorkflow new ActivityOptions { StartToCloseTimeout = TimeSpan.FromMinutes(5), RetryPolicy = retryPolicy } ); // If refund is successful, but deposit failed - throw new ApplicationFailureException($"Failed to deposit money into account {details.TargetAccount}. Money returned to {details.SourceAccount}. Cause: {depositEx.Message}", depositEx); + throw new ApplicationFailureException($"Failed to deposit money into account {details.TargetAccount}. Money returned to {details.SourceAccount}.", depositEx); } - catch (ApplicationFailureException refundEx) + catch (Exception refundEx) { // If both deposit and refund fail throw new ApplicationFailureException($"Failed to deposit money into account {details.TargetAccount}. Money could not be returned to {details.SourceAccount}. Cause: {refundEx.Message}", refundEx); @@ -351,7 +351,7 @@ You'll see a **Retry Policy** defined that looks like this: InitialInterval = TimeSpan.FromSeconds(1), MaximumInterval = TimeSpan.FromSeconds(100), BackoffCoefficient = 2, - MaximumAttempts = 500, + MaximumAttempts = 3, NonRetryableErrorTypes = new[] { "InvalidAccountException", "InsufficientFundsException" } ``` diff --git a/docs/tutorials/infrastructure/configuring-sqlite-binary/index.md b/docs/tutorials/infrastructure/configuring-sqlite-binary/index.md index a283436f..de768923 100644 --- a/docs/tutorials/infrastructure/configuring-sqlite-binary/index.md +++ b/docs/tutorials/infrastructure/configuring-sqlite-binary/index.md @@ -353,4 +353,4 @@ Refer to the [Temporal documentation](https://docs.temporal.io/) for more. ## Conclusion -In this tutorial, you configured and deployed a baseline Temporal Service. Next, you can read about Temporal's [Visiblity features](https://docs.temporal.io/visibility) which require adding ElasticSearch to your deployment. You can also [learn more about the Temporal platform by following our self-paced online courses](https://learn.temporal.io/courses/), or talk to an expert about [Temporal Cloud](https://temporal.io/cloud). \ No newline at end of file +In this tutorial, you configured and deployed a baseline Temporal Service. Next, you can read about Temporal's [Visiblity features](https://docs.temporal.io/visibility) which require adding ElasticSearch to your deployment. You can also [learn more about the Temporal platform by following our self-paced online courses](https://learn.temporal.io/courses/), or talk to an expert about [Temporal Cloud](https://temporal.io/cloud). diff --git a/docs/tutorials/infrastructure/envoy-sqlite-binary/index.md b/docs/tutorials/infrastructure/envoy-sqlite-binary/index.md index ce6924cc..bacc65d9 100644 --- a/docs/tutorials/infrastructure/envoy-sqlite-binary/index.md +++ b/docs/tutorials/infrastructure/envoy-sqlite-binary/index.md @@ -510,4 +510,4 @@ Refer to the [Temporal documentation](https://docs.temporal.io/) for more. ## Conclusion -In this tutorial, you configured and deployed a baseline Temporal Service. Next, you can read about Temporal's [Visiblity features](https://docs.temporal.io/visibility) which require adding ElasticSearch to your deployment. You can also [learn more about the Temporal platform by following our self-paced online courses](https://learn.temporal.io/courses/), or talk to an expert about [Temporal Cloud](https://temporal.io/cloud). \ No newline at end of file +In this tutorial, you configured and deployed a baseline Temporal Service. Next, you can read about Temporal's [Visiblity features](https://docs.temporal.io/visibility) which require adding ElasticSearch to your deployment. You can also [learn more about the Temporal platform by following our self-paced online courses](https://learn.temporal.io/courses/), or talk to an expert about [Temporal Cloud](https://temporal.io/cloud). diff --git a/docs/tutorials/infrastructure/nginx-sqlite-binary/index.md b/docs/tutorials/infrastructure/nginx-sqlite-binary/index.md index cea7f7b6..ee36b153 100644 --- a/docs/tutorials/infrastructure/nginx-sqlite-binary/index.md +++ b/docs/tutorials/infrastructure/nginx-sqlite-binary/index.md @@ -417,4 +417,4 @@ Refer to the [Temporal documentation](https://docs.temporal.io/) for more. ## Conclusion -In this tutorial, you configured and deployed a baseline Temporal Service. Next, you can read about Temporal's [Visiblity features](https://docs.temporal.io/visibility) which require adding ElasticSearch to your deployment. You can also [learn more about the Temporal platform by following our self-paced online courses](https://learn.temporal.io/courses/), or talk to an expert about [Temporal Cloud](https://temporal.io/cloud). \ No newline at end of file +In this tutorial, you configured and deployed a baseline Temporal Service. Next, you can read about Temporal's [Visiblity features](https://docs.temporal.io/visibility) which require adding ElasticSearch to your deployment. You can also [learn more about the Temporal platform by following our self-paced online courses](https://learn.temporal.io/courses/), or talk to an expert about [Temporal Cloud](https://temporal.io/cloud). diff --git a/docs/tutorials/java/background-check/code/backgroundcheck-replay/src/test/java/backgroundcheckreplay/BackgroundCheckReplayWorkflowTest.java b/docs/tutorials/java/background-check/code/backgroundcheck-replay/src/test/java/backgroundcheckreplay/BackgroundCheckReplayWorkflowTest.java index dcdddd71..82b8f966 100644 --- a/docs/tutorials/java/background-check/code/backgroundcheck-replay/src/test/java/backgroundcheckreplay/BackgroundCheckReplayWorkflowTest.java +++ b/docs/tutorials/java/background-check/code/backgroundcheck-replay/src/test/java/backgroundcheckreplay/BackgroundCheckReplayWorkflowTest.java @@ -55,8 +55,7 @@ public void testSuccessfulBackgroundCheckBoilerplateWithMocks(TestWorkflowEnviro } @Test - public void testSuccessfulReplayFromFile(TestWorkflowEnvironment testEnv, Worker worker, - BackgroundCheckReplayWorkflow workflow) throws Exception { + public void testSuccessfulReplayFromFile(BackgroundCheckReplayWorkflow workflow) throws Exception { File eventHistoryFile = new File("backgroundcheck_workflow_event_history.json"); diff --git a/docs/tutorials/java/background-check/durable-execution.mdx b/docs/tutorials/java/background-check/durable-execution.mdx index af14cbf1..85a6814e 100644 --- a/docs/tutorials/java/background-check/durable-execution.mdx +++ b/docs/tutorials/java/background-check/durable-execution.mdx @@ -145,8 +145,7 @@ Add the Replay test to the set of application tests. ```java // ... @Test - public void testSuccessfulReplayFromFile(TestWorkflowEnvironment testEnv, Worker worker, - BackgroundCheckReplayWorkflow workflow) throws Exception { + public void testSuccessfulReplayFromFile(BackgroundCheckReplayWorkflow workflow) throws Exception { File eventHistoryFile = new File("backgroundcheck_workflow_event_history.json"); @@ -154,6 +153,7 @@ Add the Replay test to the set of application tests. BackgroundCheckReplayWorkflowImpl.class)); } +} ``` diff --git a/docs/tutorials/java/background-check/project-setup.mdx b/docs/tutorials/java/background-check/project-setup.mdx index b654873e..446f6e08 100644 --- a/docs/tutorials/java/background-check/project-setup.mdx +++ b/docs/tutorials/java/background-check/project-setup.mdx @@ -363,7 +363,7 @@ In the Temporal Java SDK programming model, a [Workflow Definition](https://docs #### Boilerplate Workflow Interface {#workflow-code} -[BackgroundCheckBoilerplateWorkflow.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateWorkflow.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateWorkflow.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateWorkflow.java) ```java package backgroundcheckboilerplate; @@ -395,7 +395,7 @@ There can only be one Workflow Method per Workflow Definition. Now that you've defined your Workflow Interface you can define its implementation. -[BackgroundCheckBoilerplateWorkflowImpl.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateWorkflowImpl.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateWorkflowImpl.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateWorkflowImpl.java) ```java package backgroundcheckboilerplate; @@ -461,7 +461,7 @@ In the Temporal Java SDK programming model, an Activity is defined as an interfa The `BackgroundCheckActivity` interface below is an example of a the first part defining an Activity -[BackgroundCheckBoilerplateActivities.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateActivities.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateActivities.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateActivities.java) ```java package backgroundcheckboilerplate; @@ -491,7 +491,7 @@ Activity. There can multiple Activity Methods per Activity Definition. Now that you've defined your Activity Interface you can define its implementation. -[BackgroundCheckBoilerplateActivitiesImpl.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateActivitiesImpl.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateActivitiesImpl.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/BackgroundCheckBoilerplateActivitiesImpl.java) ```java package backgroundcheckboilerplate; @@ -551,7 +551,7 @@ To run a Worker Process with a local development server, define the following st Temporal recommends keeping Worker code separate from Workflow and Activity code. -[workers/DevServerWorker.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/DevServerWorker.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/DevServerWorker.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/DevServerWorker.java) ```java package backgroundcheckboilerplate.workers; @@ -599,7 +599,7 @@ A Temporal Cloud Worker requires that you specify the following in the Client co - Certificate and private key associated with the Namespace -[workers/CloudWorker.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/CloudWorker.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/CloudWorker.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/CloudWorker.java) ```java package backgroundcheckboilerplate.workers; @@ -758,7 +758,7 @@ Set IP address and port in the Service Stubs Options and the Namespace in the Temporal Client options. -[workers/SelfHostedWorker.java](code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/SelfHostedWorker.java) +[docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/SelfHostedWorker.java](https://github.com/temporalio/temporal-learning/blob/main/docs/tutorials/java/background-check/code/backgroundcheck/src/main/java/backgroundcheckboilerplate/workers/SelfHostedWorker.java) ```java package backgroundcheckboilerplate.workers; diff --git a/docs/tutorials/java/build-an-email-drip-campaign/index.md b/docs/tutorials/java/build-an-email-drip-campaign/index.md index ef7eed3a..7381e2cf 100644 --- a/docs/tutorials/java/build-an-email-drip-campaign/index.md +++ b/docs/tutorials/java/build-an-email-drip-campaign/index.md @@ -459,6 +459,13 @@ import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import subscription.model.*; import subscription.workflows.SendEmailWorkflow; + +@RestController +public class Controller { + + @Autowired + WorkflowClient client; + ``` diff --git a/docs/tutorials/python/background-check/code/backgroundcheck_replay/tests/replay_dacx_test.py b/docs/tutorials/python/background-check/code/backgroundcheck_replay/tests/replay_dacx_test.py index ae0aee99..689db1f3 100644 --- a/docs/tutorials/python/background-check/code/backgroundcheck_replay/tests/replay_dacx_test.py +++ b/docs/tutorials/python/background-check/code/backgroundcheck_replay/tests/replay_dacx_test.py @@ -39,10 +39,9 @@ async def test_execute_workflow(): # @@@SNIPSTART python-durability-chapter-replay-from-file-test @pytest.mark.asyncio async def test_replay_workflow_history_from_file(): - async with await WorkflowEnvironment.start_time_skipping(): - with open("tests/backgroundcheck_workflow_history.json", "r") as f: - history_json = json.load(f) - await Replayer(workflows=[BackgroundCheck]).replay_workflow( - WorkflowHistory.from_json("backgroundcheck_workflow", history_json) - ) + with open("tests/backgroundcheck_workflow_history.json", "r") as f: + history_json = json.load(f) + await Replayer(workflows=[BackgroundCheck]).replay_workflow( + WorkflowHistory.from_json("backgroundcheck_workflow", history_json) + ) # @@@SNIPEND diff --git a/docs/tutorials/python/background-check/durable-execution.mdx b/docs/tutorials/python/background-check/durable-execution.mdx index 1736eae6..db882f41 100644 --- a/docs/tutorials/python/background-check/durable-execution.mdx +++ b/docs/tutorials/python/background-check/durable-execution.mdx @@ -158,12 +158,11 @@ If the Workflow Definition and the Event History are incompatible, then the test ```py @pytest.mark.asyncio async def test_replay_workflow_history_from_file(): - async with await WorkflowEnvironment.start_time_skipping(): - with open("tests/backgroundcheck_workflow_history.json", "r") as f: - history_json = json.load(f) - await Replayer(workflows=[BackgroundCheck]).replay_workflow( - WorkflowHistory.from_json("backgroundcheck_workflow", history_json) - ) + with open("tests/backgroundcheck_workflow_history.json", "r") as f: + history_json = json.load(f) + await Replayer(workflows=[BackgroundCheck]).replay_workflow( + WorkflowHistory.from_json("backgroundcheck_workflow", history_json) + ) ```