-
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.
Refactor background activities scheduling
Background activities scheduling was moved to its own middleware where the actual scheduling happens instead of in the invoking middleware. Removed ScheduleBackgroundActivities.cs handler and added ScheduleBackgroundActivitiesMiddleware.cs instead. As a part of this change, restructured BackgroundActivityInvokerMiddleware to BackgroundActivityCollectorMiddleware, and updated all relevant references. Minor modifications to a few other files include changes in their package dependencies and activity kind settings.
- Loading branch information
1 parent
19522e4
commit fc878a4
Showing
11 changed files
with
67 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Bogus; | ||
using Elsa.Extensions; | ||
using Elsa.Workflows.Core; | ||
using Elsa.Workflows.Core.Attributes; | ||
using Elsa.Workflows.Core.Models; | ||
|
||
namespace Elsa.WorkflowServer.Web; | ||
|
||
[Activity("Demo", "Data Source", "Generates a collection of random strings.")] | ||
public class DataSourceActivity : CodeActivity<ICollection<string>> | ||
{ | ||
[Input(Description = "The number of items to generate.")] | ||
public Input<int> NumberOfItems { get; set; } = default!; | ||
|
||
|
||
protected override void Execute(ActivityExecutionContext context) | ||
{ | ||
var randomizer = new Randomizer(); | ||
var randomStrings = new List<string>(); | ||
var numberOfItems = context.Get(NumberOfItems); | ||
|
||
for (var i = 0; i < numberOfItems; i++) | ||
{ | ||
var randomString = randomizer.String2(10); | ||
randomStrings.Add(randomString); | ||
} | ||
|
||
Result.Set(context, randomStrings); | ||
} | ||
} |
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
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
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
36 changes: 16 additions & 20 deletions
36
.../Handlers/ScheduleBackgroundActivities.cs → ...ScheduleBackgroundActivitiesMiddleware.cs
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