-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/danielgerlag/workflow-core
# Conflicts: # WorkflowCore.sln
- Loading branch information
Showing
15 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Recur sample | ||
|
||
Illustrates how to run a set of recurring background steps within your workflow, until a certain condition is met | ||
|
||
|
||
```c# | ||
builder | ||
.StartWith(context => Console.WriteLine("Hello")) | ||
.Recur(data => TimeSpan.FromSeconds(5), data => data.Counter > 5).Do(recur => recur | ||
.StartWith(context => Console.WriteLine("Doing recurring task")) | ||
) | ||
.Then(context => Console.WriteLine("Carry on")); | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using WorkflowCore.Interface; | ||
|
||
namespace WorkflowCore.Sample16 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
var serviceProvider = ConfigureServices(); | ||
|
||
//start the workflow host | ||
var host = serviceProvider.GetService<IWorkflowHost>(); | ||
host.RegisterWorkflow<ScheduleWorkflow>(); | ||
host.Start(); | ||
|
||
Console.WriteLine("Starting workflow..."); | ||
var workflowId = host.StartWorkflow("schedule-sample").Result; | ||
|
||
Console.ReadLine(); | ||
host.Stop(); | ||
} | ||
|
||
private static IServiceProvider ConfigureServices() | ||
{ | ||
//setup dependency injection | ||
IServiceCollection services = new ServiceCollection(); | ||
services.AddLogging(); | ||
services.AddWorkflow(); | ||
|
||
var serviceProvider = services.BuildServiceProvider(); | ||
|
||
//config logging | ||
var loggerFactory = serviceProvider.GetService<ILoggerFactory>(); | ||
//loggerFactory.AddDebug(LogLevel.Debug); | ||
return serviceProvider; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Schedule sample | ||
|
||
Illustrates how to schedule a future set of steps to run asynchronously in the background within your workflow. | ||
|
||
|
||
```c# | ||
builder | ||
.StartWith(context => Console.WriteLine("Hello")) | ||
.Schedule(data => TimeSpan.FromSeconds(5)).Do(schedule => schedule | ||
.StartWith(context => Console.WriteLine("Doing scheduled tasks")) | ||
) | ||
.Then(context => Console.WriteLine("Doing normal tasks")); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using WorkflowCore.Interface; | ||
|
||
namespace WorkflowCore.Sample16 | ||
{ | ||
class ScheduleWorkflow : IWorkflow | ||
{ | ||
public string Id => "schedule-sample"; | ||
public int Version => 1; | ||
|
||
public void Build(IWorkflowBuilder<object> builder) | ||
{ | ||
builder | ||
.StartWith(context => Console.WriteLine("Hello")) | ||
.Schedule(data => TimeSpan.FromSeconds(5)).Do(schedule => schedule | ||
.StartWith(context => Console.WriteLine("Doing scheduled tasks")) | ||
) | ||
.Then(context => Console.WriteLine("Doing normal tasks")); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/samples/WorkflowCore.Sample16/WorkflowCore.Sample16.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\WorkflowCore\WorkflowCore.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |