From c3a3e5be87469128a3dfc7e1c04fcc53ca09ae69 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sun, 10 Dec 2023 22:28:24 +0100 Subject: [PATCH] Update README with scheduling instructions Added detailed instructions in the README file on how to update the Program.cs file with the UseScheduling() method. Also made modifications to the HeartbeatWorkflow class to use the Elsa.Scheduling.Activities.Timer. --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c297e03ea..f1f73f79a 100644 --- a/README.md +++ b/README.md @@ -269,9 +269,23 @@ First, add the following package: dotnet add package Elsa.Scheduling --prerelease ``` +Then update the `Program.cs` file as follows by adding the `UseScheduling()` method inside the `AddElsa()` method: + +```csharp +// Enable timer based activities. +.UseScheduling() +``` + Next, create a new file called `HeartbeatWorkflow.cs` and add the following code: ```csharp +using Elsa.Common.Contracts; +using Elsa.Workflows.Core; +using Elsa.Workflows.Core.Activities; +using Elsa.Workflows.Core.Contracts; + +namespace ElsaWeb; + public class HeartbeatWorkflow : WorkflowBase { protected override void Build(IWorkflowBuilder builder) @@ -280,7 +294,7 @@ public class HeartbeatWorkflow : WorkflowBase { Activities = { - new Timer(TimeSpan.FromSeconds(5)) + new Elsa.Scheduling.Activities.Timer(TimeSpan.FromSeconds(5)) { CanStartWorkflow = true },