Skip to content

Commit 11b5265

Browse files
authored
Merge pull request #50 from danielgerlag/read-ahead
2 parents db64e1f + 236c8e7 commit 11b5265

File tree

91 files changed

+1628
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1628
-840
lines changed

ReleaseNotes/1.3.0.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Workflow Core 1.3.0
2+
3+
* Added support for async steps
4+
5+
Simply inherit from `StepBodyAsync` instead of `StepBody`
6+
7+
```c#
8+
public class DoSomething : StepBodyAsync
9+
{
10+
public override async Task<ExecutionResult> RunAsync(IStepExecutionContext context)
11+
{
12+
await Task.Delay(2000);
13+
return ExecutionResult.Next();
14+
}
15+
}
16+
```
17+
18+
* Migrated from managing own thread pool to TPL datablocks for queue consumers
19+
20+
* After executing a workflow, will determine if it is scheduled to run before the next poll, if so, will delay queue it

WorkflowCore.sln

Lines changed: 41 additions & 40 deletions
Large diffs are not rendered by default.

src/WorkflowCore/Interface/IBackgroundWorker.cs renamed to src/WorkflowCore/Interface/IBackgroundTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
namespace WorkflowCore.Interface
33
{
4-
public interface IBackgroundWorker
4+
public interface IBackgroundTask
55
{
66
void Start();
77
void Stop();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace WorkflowCore.Interface
4+
{
5+
public interface IDateTimeProvider
6+
{
7+
DateTime Now { get; }
8+
}
9+
}

src/WorkflowCore/Interface/IDistributedLockProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Threading;
45
using System.Threading.Tasks;
56

67
namespace WorkflowCore.Interface
@@ -11,7 +12,7 @@ namespace WorkflowCore.Interface
1112
/// </remarks>
1213
public interface IDistributedLockProvider
1314
{
14-
Task<bool> AcquireLock(string Id);
15+
Task<bool> AcquireLock(string Id, CancellationToken cancellationToken);
1516

1617
Task ReleaseLock(string Id);
1718

src/WorkflowCore/Interface/IEventThread.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/WorkflowCore/Interface/IPersistenceProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IPersistenceProvider
1616

1717
Task PersistWorkflow(WorkflowInstance workflow);
1818

19-
Task<IEnumerable<string>> GetRunnableInstances();
19+
Task<IEnumerable<string>> GetRunnableInstances(DateTime asAt);
2020

2121
Task<IEnumerable<WorkflowInstance>> GetWorkflowInstances(WorkflowStatus? status, string type, DateTime? createdFrom, DateTime? createdTo, int skip, int take);
2222

@@ -32,7 +32,7 @@ public interface IPersistenceProvider
3232

3333
Task<Event> GetEvent(string id);
3434

35-
Task<IEnumerable<string>> GetRunnableEvents();
35+
Task<IEnumerable<string>> GetRunnableEvents(DateTime asAt);
3636

3737
Task<IEnumerable<string>> GetEvents(string eventName, string eventKey, DateTime asOf);
3838

src/WorkflowCore/Interface/IQueueProvider.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Threading;
45
using System.Threading.Tasks;
56
using WorkflowCore.Models;
67

@@ -25,7 +26,9 @@ public interface IQueueProvider : IDisposable
2526
/// If the queue is empty, NULL is returned
2627
/// </summary>
2728
/// <returns></returns>
28-
Task<string> DequeueWork(QueueType queue);
29+
Task<string> DequeueWork(QueueType queue, CancellationToken cancellationToken);
30+
31+
bool IsDequeueBlocking { get; }
2932

3033
Task Start();
3134
Task Stop();

src/WorkflowCore/Interface/IRunnablePoller.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/WorkflowCore/Interface/IStepBody.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ namespace WorkflowCore.Interface
88
{
99
public interface IStepBody
1010
{
11-
ExecutionResult Run(IStepExecutionContext context);
11+
Task<ExecutionResult> RunAsync(IStepExecutionContext context);
1212
}
1313
}

0 commit comments

Comments
 (0)