Skip to content

Commit 03ec21f

Browse files
authored
Merge pull request #30 from kbilsted/v1.5.1
V1.5.1
2 parents f1f193c + ad5e281 commit 03ec21f

File tree

12 files changed

+402
-45
lines changed

12 files changed

+402
-45
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Micro Workflow .net
22
<!--start-->
3-
[![Stats](https://img.shields.io/badge/Code_lines-1,7_K-ff69b4.svg)]()
3+
[![Stats](https://img.shields.io/badge/Code_lines-1,8_K-ff69b4.svg)]()
44
[![Stats](https://img.shields.io/badge/Test_lines-1,2_K-69ffb4.svg)]()
5-
[![Stats](https://img.shields.io/badge/Doc_lines-594-ffb469.svg)]()
5+
[![Stats](https://img.shields.io/badge/Doc_lines-936-ffb469.svg)]()
66
<!--end-->
77

8-
98
<p align="center"> <img src="doc/microworkflow.webp" alt="logo"></p>
109

1110
Micro Workflow is a very fast, small, embedable and distributed workflow system primarily for .Net developers.
@@ -14,22 +13,27 @@ The code base is so small every one can read and understand the inner workings i
1413

1514
# 1. Why use Micro Workflow
1615

17-
You should consider using Micro Workflow due to one or more of the following reason
16+
You should consider using Micro Workflow for one or more of the following reasons.
17+
* When you have a need for a queue,
18+
* scheduling and re-scheduling of code to be executed
19+
* distributing load across multiple servers
20+
* or a business process that needs to be robust (have it being broken up into steps and its progress persisted).
1821

19-
when you have a need for a queue, scheduling of code to execute, or a business process that needs to be robus. We provide many examples in ["integration patterns"](https://github.com/kbilsted/MicroWorkflow.net/tree/feature/doc?tab=readme-ov-file#5-integration-patterns)
22+
We provide many examples in ["integration patterns"](https://github.com/kbilsted/MicroWorkflow.net/tree/feature/doc?tab=readme-ov-file#5-integration-patterns) on how to get started.
2023

24+
Design philosophy
2125

2226
**Simplicity**
2327
* We model only the steps in a workflow, *not* the transitions between them
24-
* This greatly *simplify* the model, the versioning of flows and steps
25-
* enable you to use reusable code blocks for determining a transition
26-
* It is *easy* to embed it directly into your solutions to improve resiliance or use as a stand-alone workflow
28+
* This greatly *simplifies* the model, especially when dealing with change and versioning
29+
* It enables you to use reusable code blocks for determining a transition
30+
* It is *easy* to embed micro workflow directly into your solutions to improve resiliance or use as a stand-alone workflow
2731

2832
**We use C# all the way**
29-
* We don't want to invent a new language - we love C#!
33+
* We don't want to invent a new language for the workflow - we love C#!
3034
* Workflow code is *readable*, *debugable*, and *testable* - like the rest of your code base.
3135
* You can use existing best practices for logging, IOC containers etc. of your choice
32-
* Since Workflow code is just C# it is *easy to commit and merge* use your existing *branching strategies*
36+
* Workflow code is just C# so it is *easy to commit and merge* using your existing *branching strategies*
3337
* You *do not* need a special graphical editor for specifying flows
3438

3539
**The datamodel is simple - just three DB tables**
@@ -38,15 +42,15 @@ when you have a need for a queue, scheduling of code to execute, or a business p
3842

3943
**Distributed mindset**
4044
* Supports *Fail-over setup* To improve up-time applications/integrations are often running on multiple servers at the same time. This is a common scenario is supported with no special setup.
41-
* Supports incremental deployments across more instances. When deploying multiple instances, the roll-out is typical gradual. Hence we support that steps may be added that is only known to a sub-set of the running workflows.
45+
* Supports incremental deployments across multiple instances, meaning the roll-out is gradual. Hence we support that steps may be added that is only known to a sub-set of the running workflows.
4246

4347
**Scalable**
4448
* You can add more workers in the workflow engine (vertical scaling)
4549
* You can add more servers each running a workflow engine (horizontal scaling)
4650

4751
**No external dependencies**
4852
* The core library has *no external dependencies*, you can use whatever database, logger, json/xml/binary serializer you want ... in any version you want
49-
* Convenience supplement nuget packages for Newtonsoft json, Ado .net, and Autofac are provided
53+
* To get you quickly started, we supply nuget packages for "Newtonsoft Json", "Ado .Net Db", and "Autofac IOC". The packages are completely optional.
5054

5155

5256
# 2. Overview
@@ -61,11 +65,11 @@ Supported scalabilities
6165

6266
# 3. Getting started
6367

64-
To define a workflow with the two steps `FetchData` (which fetches some data), and `AnalyzeWords` (that analyzes the data), we implement interface `IStepImplementation` twice.
65-
To transition from one step to one (or several steps), use `Done()`. This tells the engine that the current step has finished sucesfully. You can supply one or more steps that will be executed in the future.
68+
To define a workflow with the two steps, a `FetchData` step that fetches some data, and a `AnalyzeWords` step that analyzes the data, we implement interface `IStepImplementation` twice.
69+
To transition from one step to another, the step uses `return Done()`. This tells the engine that the current step has finished sucesfully. You can supply one or more steps that will be executed as a result of the success.
6670
This is how you control ordering of events.
6771

68-
There are no restrictions on the names of steps, but we found using a scheme similar to REST api's is beneficial. Hence we recommend you to use `{version}/{business domain}/{workflow name}/{workflow step}`.
72+
There are no restrictions on the names of steps, but we found using a scheme similar to REST api's to be beneficial. Hence using the following format `{version}/{business domain}/{workflow name}/{workflow step}`. By defining the name of the flow as a `public const` it is easy to "find usage" inside the code base and to ensure no mis-spelling. Two workflow steps cannot have the same name.
6973

7074
```C#
7175
[StepName(Name)]

src/Demos/ConsoleDemo/MicroWorkflow.ConsoleDemo.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Autofac" Version="8.0.0" />
13+
<PackageReference Include="Autofac" Version="8.1.1" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/Demos/MicroWorkflow.Tests/AdoSingletonStepTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public void When_creating_a_singleton_Then_it_is_created()
2424
Singleton = true,
2525
FlowId = helper.FlowId
2626
}];
27-
helper.StepHandlers = [Handle(name, step => {
27+
helper.StepHandlers = [Handle(name, step => {
2828
stepResult = $"hello";
2929
stepResultIsSingleton = step.Singleton;
30-
return step.Done();
30+
return step.Done();
3131
})];
3232
helper.StopWhenNoWork().BuildAndStart();
3333

@@ -74,13 +74,14 @@ public void When_AddStepIfNotExists_two_identical_singleton_steps_Then_insert_fi
7474
var name = helper.RndName;
7575
var step = new Step(name) { Singleton = true };
7676
SearchModel searchModel = new(Name: step.Name);
77-
engine.Data.AddStepIfNotExists(step, searchModel)
78-
.Should()
77+
78+
var id = engine.Data.AddStepIfNotExists(step, searchModel);
79+
id.Should()
7980
.HaveValue();
8081

8182
var step2 = new Step(name) { Singleton = true };
82-
engine.Data.AddStepIfNotExists(step2, searchModel)
83-
.Should()
83+
id = engine.Data.AddStepIfNotExists(step2, searchModel);
84+
id.Should()
8485
.BeNull();
8586
}
8687
}

src/Demos/MicroWorkflow.Tests/DocumentationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<ExecutionResult> ExecuteAsync(Step step)
6565

6666
// ... stuff
6767

68-
return step.Done();
68+
return await Task.FromResult(step.Done());
6969
}
7070
}
7171

@@ -82,7 +82,7 @@ public async Task<ExecutionResult> ExecuteAsync(Step step)
8282

8383
// ... fetch data
8484

85-
return step.Rerun(scheduleTime: step.ExecutionStartTime!.Value.AddHours(1));
85+
return await Task.FromResult(step.Rerun(scheduleTime: step.ExecutionStartTime!.Value.AddHours(1)));
8686
}
8787
}
8888

src/Demos/MicroWorkflow.Tests/MicroWorkflow.Tests.csproj

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Autofac" Version="8.0.0" />
12-
<PackageReference Include="AutoFixture" Version="4.18.1" />
13-
<PackageReference Include="FluentAssertions" Version="6.12.0" />
11+
<PackageReference Include="Autofac" Version="8.1.1" />
12+
<PackageReference Include="FluentAssertions" Version="7.0.0" />
1413
<PackageReference Include="LineCounter" Version="1.1.1" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
16-
<PackageReference Include="NUnit" Version="4.1.0" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
18-
<PackageReference Include="coverlet.collector" Version="6.0.1">
19-
<PrivateAssets>all</PrivateAssets>
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
</PackageReference>
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
15+
<PackageReference Include="NUnit" Version="4.3.0" />
16+
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
2217
<PackageReference Include="ReassureTest" Version="0.8.0" />
2318
</ItemGroup>
2419

src/Demos/MicroWorkflow.Tests/PerformanceTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace MicroWorkflow;
77

8+
[Explicit("slow")]
89
public class PerformanceTests
910
{
1011
[Test]

src/Demos/WebApiDemo/MicroWorkflow.WebApiDemo.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Autofac" Version="8.0.0" />
13-
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
14-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
12+
<PackageReference Include="Autofac" Version="8.1.1" />
13+
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
14+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Product/MicroWorkflow.AdoPersistence/MicroWorkflow.AdoMsSql.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.5" />
34+
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
3535
</ItemGroup>
3636

3737
<ItemGroup>

src/Product/MicroWorkflow.Ioc.Autofac/MicroWorkflow.Ioc.Autofac.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</ItemGroup>
3737

3838
<ItemGroup>
39-
<PackageReference Include="Autofac" Version="8.0.0" />
39+
<PackageReference Include="Autofac" Version="8.1.1" />
4040
<ProjectReference Include="..\MicroWorkflow\MicroWorkflow.csproj" />
4141

4242
</ItemGroup>

0 commit comments

Comments
 (0)