Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Workflow Runtimes #5444

Merged
merged 159 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
854283d
Add caching to workflow runtime and workflow management stores
sfmskywalker Apr 2, 2024
bcd8c07
Refactor WorkflowsMiddleware for HTTP Endpoint bookmarks and triggers
sfmskywalker Apr 3, 2024
cd87898
Update HTTP endpoint authorization to use Workflow context
sfmskywalker Apr 3, 2024
0a1814c
Add FindAsync methods to trigger and bookmark stores
sfmskywalker Apr 3, 2024
28edb41
Refactor WorkflowsMiddleware for improved workflow handling
sfmskywalker Apr 3, 2024
92864f6
Add caching functionality to WorkflowsMiddleware
sfmskywalker Apr 3, 2024
6652ade
Implement dynamic cache duration for workflows
sfmskywalker Apr 3, 2024
168b36d
Add HttpWorkflowsCacheManager for caching HTTP workflows
sfmskywalker Apr 3, 2024
97b57f0
Refactor workflow trigger handling and caching
sfmskywalker Apr 3, 2024
f4553f2
Add summary to IndexedWorkflowTriggers
sfmskywalker Apr 3, 2024
4aff973
Refactor memory caching feature into separate module
sfmskywalker Apr 3, 2024
c90c94c
Add distributed caching and update async methods
sfmskywalker Apr 3, 2024
13b59cb
Add distributed caching with MassTransit support
sfmskywalker Apr 3, 2024
7c2ce36
Refactor queue naming and scope of MassTransitChangeTokenSignalPublisher
sfmskywalker Apr 3, 2024
6f1eebc
Add caching capabilities to workflow definition service
sfmskywalker Apr 3, 2024
3d2d065
Refactor caching mechanism in workflow definition
sfmskywalker Apr 3, 2024
d84d362
Merge remote-tracking branch 'origin/main' into issue/5135
sfmskywalker Apr 3, 2024
601509e
Update MassTransitBroker and enable RealTimeWorkflows and SignalRHubs
sfmskywalker Apr 3, 2024
ef25c50
Reformat variable types in HttpFeature
sfmskywalker Apr 3, 2024
f8af20c
Update HTTP workflows cache invalidation handler XML comment
sfmskywalker Apr 3, 2024
318dace
Remove unnecessary using directives
sfmskywalker Apr 3, 2024
9470834
Refactor HttpWorkflowsMiddleware constructor
sfmskywalker Apr 3, 2024
8d617af
Simplify workflow retrieval in HttpWorkflowsMiddleware
sfmskywalker Apr 3, 2024
1532025
Refactor workflow retrieval in HttpBookmarkProcessor
sfmskywalker Apr 3, 2024
9455da1
Optimize FindWorkflowAsync method in HttpWorkflowsCacheManager
sfmskywalker Apr 3, 2024
974dfa3
Refactor Endpoint.cs for workflow retrieval
sfmskywalker Apr 3, 2024
17772a2
Refactor InputFunctionsDefinitionProvider constructor
sfmskywalker Apr 3, 2024
5844111
Refactor WorkflowInstance with improved state handling
sfmskywalker Apr 3, 2024
d151fa8
Remove unused IBookmarkManager and update workflow functions
sfmskywalker Apr 3, 2024
0882bc7
Remove unused ReSharper directive
sfmskywalker Apr 3, 2024
df99515
Update activity invocation in workflow runtime
sfmskywalker Apr 3, 2024
cac88c5
Refactor code to simplify workflow definition loading
sfmskywalker Apr 3, 2024
a59bd49
Refactor WorkflowHostFactory to streamline workflow creation
sfmskywalker Apr 3, 2024
85feb33
Refactor workflow retrieval in WorkflowInstance.cs
sfmskywalker Apr 3, 2024
a3c9d1b
Remove unnecessary whitespace in WorkflowInstance.cs
sfmskywalker Apr 3, 2024
51ee271
Remove unnecessary comment in ProtoActorWorkflowRuntime
sfmskywalker Apr 3, 2024
a67cf7c
Update workflow management features and handlers
sfmskywalker Apr 4, 2024
175da9c
Add multiple log record support to workflow execution log stores
sfmskywalker Apr 4, 2024
3ef082f
Remove redundant workflow definition check
sfmskywalker Apr 4, 2024
ec372ca
Improve cancellation token usage in workflow execution
sfmskywalker Apr 5, 2024
324b5e5
Add PersistStateAsync method to WorkflowHost
sfmskywalker Apr 6, 2024
8ec925a
Refactor DefaultAlterationRunner service
sfmskywalker Apr 6, 2024
3af63cd
Refine wording in IWorkflowHost interface documentation
sfmskywalker Apr 6, 2024
8aa8417
Remove CancellationTokens struct and simplify cancellation handling
sfmskywalker Apr 6, 2024
0a629a1
Implement ActivityHandle for better activity identification
sfmskywalker Apr 6, 2024
b86705d
Remove AzureContainerApps related code
sfmskywalker Apr 6, 2024
7ca01ae
Add distributed execution runtime and client
sfmskywalker Apr 6, 2024
dcb9abf
Remove WorkflowClient.cs from Elsa.Workflows.Runtime
sfmskywalker Apr 6, 2024
837e9a8
Add ProtoActor implementation for workflow execution
sfmskywalker Apr 7, 2024
81ce49d
Refactor workflow parameters to workflow requests
sfmskywalker Apr 7, 2024
ff3956d
Add ProtoActor implementation for data mappers
sfmskywalker Apr 7, 2024
aa26566
Add functionality to create a new workflow instance
sfmskywalker Apr 7, 2024
23d9ddb
Remove Elsa.Runtimes.DistributedLockingRuntime module
sfmskywalker Apr 7, 2024
5349afd
Add dynamic client type to WorkflowClientFactory
sfmskywalker Apr 7, 2024
a84fbc7
Implement Proto.Actor support in Elsa
sfmskywalker Apr 7, 2024
31e117b
Refactor null-checks in SaveSnapshotAsync method
sfmskywalker Apr 7, 2024
95d5a6e
Merge branch 'main' into hyperscale
sfmskywalker Apr 10, 2024
9c5321b
Merge branch 'main' into hyperscale
sfmskywalker Apr 14, 2024
84943d0
Refactor code and update packages
sfmskywalker Apr 14, 2024
3589bec
Add Proto.Cluster.AzureContainerApps package to Directory.Packages.props
sfmskywalker Apr 14, 2024
2454768
Remove redundant Proto.Actor implementation files
sfmskywalker Apr 14, 2024
aab4963
Add WorkflowMatcher and replace BookmarkHasher with StimulusHasher
sfmskywalker Apr 15, 2024
a62cd2b
Merge remote-tracking branch 'origin/main' into hyperscale
sfmskywalker Apr 15, 2024
da7ee1e
Incremental work on stimuli refactoring
sfmskywalker Apr 16, 2024
ff76ba6
Refactor codebase to support new IWorkflowInvoker and invoke workflow…
sfmskywalker Apr 17, 2024
5364441
bumped versions to fix dependency vulnerabilities (#5256)
stevetayloruk Apr 26, 2024
18ca2d8
Update patch version in GitHub workflows
sfmskywalker Apr 26, 2024
3f51cee
Update git branch grep pattern in workflow file
sfmskywalker Apr 26, 2024
8c61844
Update grep command in packages workflow
sfmskywalker Apr 26, 2024
21ab77c
Merge branch 'v3.1.3' into chore/5285
sfmskywalker Apr 26, 2024
433f064
Update package versions and refactor code for Elasticsearch and JavaS…
sfmskywalker Apr 26, 2024
4cdaa2c
Merge remote-tracking branch 'origin/chore/5285' into perf/5254
sfmskywalker Apr 26, 2024
69a3237
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker Apr 26, 2024
996c1a2
Refactor workflow management with workflow definition handles
sfmskywalker Apr 27, 2024
02ea799
Add ResumeBookmarkResult and update related methods
sfmskywalker Apr 27, 2024
d1f4091
Update workflow definition, execution and correlation
sfmskywalker Apr 27, 2024
d2742f3
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 1, 2024
93e067b
Refactor runtime codebase for better structure and workflow control
sfmskywalker May 1, 2024
28aa62e
Refactor WorkflowInvoker and remove 'OriginalBookmarks'
sfmskywalker May 1, 2024
434e1c6
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 8, 2024
234980f
Removed RunWorkflowParams class
sfmskywalker May 8, 2024
863a13f
Update RunWorkflowParamsMapper to handle null or empty fields
sfmskywalker May 8, 2024
774709a
Refactor workflow handling and improve null checks
sfmskywalker May 8, 2024
64ec981
Enable ProtoActor in Elsa.Server.Web
sfmskywalker May 8, 2024
9a789df
Added new workflow scheduling and management features
sfmskywalker May 9, 2024
0721cb1
Handle null or empty workflow instance IDs and correlation IDs
sfmskywalker May 9, 2024
a49147a
Update mapping details in ResumeWorkflowJob
sfmskywalker May 9, 2024
2d2188e
Refactor AzureServiceBus module and integrate into web project
sfmskywalker May 9, 2024
2be6d41
Refactor code to use async scopes and improve service dependencies
sfmskywalker May 9, 2024
5baa01d
Add Azure Service Bus workflow component tests
sfmskywalker May 10, 2024
d77a2f0
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 10, 2024
e1c886b
Add support for deferred tasks in workflow execution context
sfmskywalker May 11, 2024
5689937
Refactor TriggerSignal and SendMessage activity execution
sfmskywalker May 11, 2024
6ec3258
Update workflow ID generation method
sfmskywalker May 11, 2024
8cde579
Add support for service bus testing in workflow tests
sfmskywalker May 11, 2024
3ab4ecb
Enhanced workflow correlation and caching in Elsa Workflows
sfmskywalker May 11, 2024
ae84c12
Renamed method argument from 'payload' to 'stimulus'
sfmskywalker May 11, 2024
e33c4f5
Refactor Workflow APIs and enhance logging
sfmskywalker May 11, 2024
3c8f4f0
Refactor AzureServiceBusTests and add workflow completion signal
sfmskywalker May 11, 2024
cac9fc1
Refactor methods to streamline workflow creation and execution
sfmskywalker May 12, 2024
d56fc78
Refactor asynchronous serialization to synchronous
sfmskywalker May 12, 2024
5deb923
Removed Elsa.ServiceBus.IntegrationTests project
sfmskywalker May 14, 2024
66ebc3f
Refactor WorkflowGrain and update ProtoActor timeouts
sfmskywalker May 14, 2024
d0f9eb6
Refactor Workflow execution and ProtoActor interaction
sfmskywalker May 17, 2024
4759058
Remove unused queue and receive timeout in WorkflowGrain
sfmskywalker May 17, 2024
daeca48
Add ProtoActor to WorkflowServer runtime
sfmskywalker May 17, 2024
6ec8e87
Add new component tests for Elsa.AzureServiceBus and remove old unit …
sfmskywalker May 17, 2024
5ac4d03
Rename GlobalUsings.cs to Usings.cs in integration tests
sfmskywalker May 17, 2024
61ab247
Refactor Azure service bus testing setup to separate extension
sfmskywalker May 17, 2024
0866a02
Uncomment 'Description' and remove 'OptionsProvider' and 'OptionsMethod'
sfmskywalker May 17, 2024
99f9064
Enable Azure Service Bus module
sfmskywalker May 17, 2024
5bcf377
Refactor ProtoActor module for workflow instance focus
sfmskywalker May 18, 2024
104bca5
Change AnalysisModeDocumentation to 'AllDisabledByDefault'
sfmskywalker May 18, 2024
e59a837
Update default value for Content and modify build properties
sfmskywalker May 18, 2024
2d480e6
Disable Azure Service Bus and initialize Customer fields
sfmskywalker May 18, 2024
3398ede
Add distributed workflow services and configurations
sfmskywalker May 18, 2024
faacc16
Refactor ReceivedServiceBusMessageModel from record to class
sfmskywalker May 19, 2024
f980e36
Refactor WorkflowInstanceImpl for improved workflow management
sfmskywalker May 19, 2024
a0a4e63
Add DefaultFormattersFeature and update dependencies
sfmskywalker May 20, 2024
560d38d
Refactor JsonFormatter with JsonSerializerOptions property
sfmskywalker May 20, 2024
00bce1b
Refactor WorkflowInstanceImpl for improved code clarity
sfmskywalker May 20, 2024
6fb5bbd
Add and update methods to workflow instances
sfmskywalker May 21, 2024
182c577
Refactor worker management in AzureServiceBus module
sfmskywalker May 22, 2024
16e8afc
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 22, 2024
6e91e33
Refactor workflow runtime with distributed locking and state checking
sfmskywalker May 22, 2024
f7e50e9
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 22, 2024
6b80ca7
Refactor DispatchWorkflowInstance in MassTransitWorkflowDispatcher
sfmskywalker May 22, 2024
529f054
Update test in BulkDispatchWorkflowsTests
sfmskywalker May 22, 2024
bae2928
Remove snapshot and persistence functionality from WorkflowInstanceImpl
sfmskywalker May 22, 2024
5f0092d
Refactor workflow client implementations and update WorkflowStateMapper
sfmskywalker May 22, 2024
0defe82
Update BulkDispatchWorkflowsTests specification
sfmskywalker May 22, 2024
183250d
Update workflow definition in BulkDispatchWorkflowsTests
sfmskywalker May 22, 2024
80504f1
Refactor BulkDispatchWorkflows and simplify error handling
sfmskywalker May 22, 2024
0ad863d
Update workflow runtime and distributed locking configuration settings
sfmskywalker May 22, 2024
c64a6c6
Replace ProtoActor with DistributedRuntime in WorkflowServer
sfmskywalker May 22, 2024
99dc2d4
Add new services and classes for workflow messaging
sfmskywalker May 24, 2024
fd80c6f
Refactor WorkflowCancellationService for cleaner syntax
sfmskywalker May 24, 2024
36273a9
Remove unused import in MassTransitWorkflowCancellationDispatcher
sfmskywalker May 24, 2024
d435839
Remove Class1 from Elsa.Testing.Shared.Component
sfmskywalker May 24, 2024
d9aaad9
Reduce default timeout in ISignalManager interface
sfmskywalker May 24, 2024
53e4148
Refactor syntax representation in SendMessage activity
sfmskywalker May 24, 2024
111dbcf
Removed obsolete 'Stimulus' property and adjusted consumers
sfmskywalker May 24, 2024
fbc76b1
Rename GetNamedWorkflowGrain to GetNamedWorkflowInstanceClient
sfmskywalker May 24, 2024
9d74dc1
Remove unused snapshot classes
sfmskywalker May 24, 2024
5433145
Remove unused field from Azure ServiceBus Worker
sfmskywalker May 25, 2024
dfde9f6
Remove WorkflowInboxMessageRecord from Elsa.Dapper module
sfmskywalker May 25, 2024
7572c7b
Add new V3_2 migrations for all database providers
sfmskywalker May 25, 2024
acd7564
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 27, 2024
d4fd715
Refactor WorkflowDefinitionFilter and update related modules
sfmskywalker May 27, 2024
d85555c
Change MongoUserStore to non-abstract class
sfmskywalker May 27, 2024
e92d48a
Add ForwardedType attribute and update bookmarks
sfmskywalker May 27, 2024
bd5b7f4
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker May 27, 2024
c1cd1aa
Merge branch 'main' into perf/5254
sfmskywalker May 27, 2024
4bfa7cf
Merge branch 'main' into perf/5254
sfmskywalker May 29, 2024
b4bd725
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker Jun 5, 2024
f365b05
Fix logger reference in exception handling
sfmskywalker Jun 5, 2024
34c4daf
Merge remote-tracking branch 'origin/main' into perf/5254
sfmskywalker Jun 10, 2024
61e0556
Refactor component tests and improve code cleanliness
sfmskywalker Jun 10, 2024
62ea932
Merge branch 'main' into perf/5254
sfmskywalker Jun 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
<!-- https://github.com/dotnet/sourcelink -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
</PropertyGroup>

<PropertyGroup>
<NoWarn>$(NoWarn);CS0162;CS1591</NoWarn>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<PackageVersion Include="Proto.Cluster" Version="1.6.0" />
<PackageVersion Include="Proto.Cluster.CodeGen" Version="1.6.0" />
<PackageVersion Include="Proto.Cluster.TestProvider" Version="1.6.0" />
<PackageVersion Include="Proto.Cluster.AzureContainerApps" Version="1.6.0" />
<PackageVersion Include="Proto.Persistence" Version="1.6.0" />
<PackageVersion Include="Proto.Persistence.Sqlite" Version="1.6.0" />
<PackageVersion Include="Proto.Persistence.SqlServer" Version="1.6.0" />
Expand Down
85 changes: 50 additions & 35 deletions Elsa.sln

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions migrations/efcore-3.2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Define the modules to update
mods=("Alterations" "Runtime" "Management" "Identity" "Labels")

# Define the list of providers
providers=("MySql" "SqlServer" "Sqlite" "PostgreSql")

# Loop through each module
for module in "${mods[@]}"; do
# Loop through each provider
for provider in "${providers[@]}"; do
providerPath="../src/modules/Elsa.EntityFrameworkCore.$provider"
migrationsPath="Migrations/$module"

echo "Updating migrations for $provider..."
echo "Provider path: ${providerPath:?}/${migrationsPath}"
echo "Migrations path: $migrationsPath"
ef-migration-runtime-schema --interface Elsa.EntityFrameworkCore.Common.Contracts.IElsaDbContextSchema --efOptions "migrations add V3_2 -c ""$module""ElsaDbContext -p ""$providerPath"" -o ""$migrationsPath"""
done
done
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace Elsa.Samples.AspNet.MassTransitWorkflow.Messages;

public class Message
{
public string Content { get; set; }
public string Content { get; set; } = default!;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Elsa.Http;
using Elsa.Workflows.Contracts;
using Microsoft.AspNetCore.Mvc;
Expand Down
2 changes: 0 additions & 2 deletions samples/aspnet/Elsa.Samples.AspNet.MyBackendApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Elsa.Extensions;
using Elsa.Samples.AspNet.MyBackendApi.Workflows;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<ProjectReference Include="..\..\..\src\modules\Elsa.EntityFrameworkCore\Elsa.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\src\modules\Elsa.Identity\Elsa.Identity.csproj" />
<ProjectReference Include="..\..\..\src\modules\Elsa.JavaScript\Elsa.JavaScript.csproj" />
<ProjectReference Include="..\..\..\src\modules\Elsa.ProtoActor.Cluster.AzureContainerApps\Elsa.ProtoActor.Cluster.AzureContainerApps.csproj" />
<ProjectReference Include="..\..\..\src\modules\Elsa.ProtoActor\Elsa.ProtoActor.csproj" />
<ProjectReference Include="..\..\..\src\modules\Elsa.Scheduling\Elsa.Scheduling.csproj" />
<ProjectReference Include="..\..\..\src\modules\Elsa.Workflows.Api\Elsa.Workflows.Api.csproj" />
Expand All @@ -26,6 +25,7 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.ResourceManager" />
<PackageReference Include="Proto.Cluster.AzureContainerApps" />
<PackageReference Include="Proto.Persistence.Sqlite" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Elsa.Extensions;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Runtime;
using Elsa.Workflows.Runtime.Contracts;
using Elsa.Workflows.Runtime.Notifications;

Expand All @@ -16,15 +14,15 @@ public OrderFoodTaskHandler(ITaskReporter taskReporter)
{
_taskReporter = taskReporter;
}

public async Task HandleAsync(RunTaskRequest notification, CancellationToken cancellationToken)
{
if (notification.TaskName != "OrderFood")
return;

var args = notification.TaskPayload!;
var foodName = args.GetValue<string>("Food");

Console.WriteLine("Preparing {0}...", foodName);
await Task.Delay(1000, cancellationToken);
Console.WriteLine("Food is ready for delivery!");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Elsa.Extensions;
using Elsa.Samples.AspNet.RunTaskIntegration.Workflows;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System.Collections.Generic;
using Elsa.Http;
using Elsa.Workflows;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Contracts;
using Elsa.Workflows.Models;
using Elsa.Workflows.Runtime.Activities;
using Microsoft.AspNetCore.Http;

namespace Elsa.Samples.AspNet.RunTaskIntegration.Workflows;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using Elsa.Extensions;
using Elsa.Samples.AspNet.Webhooks.WorkflowServer.Workflows;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System.Collections.Generic;
using Elsa.Http;
using Elsa.Workflows;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Contracts;
using Elsa.Workflows.Models;
using Elsa.Workflows.Runtime.Activities;
using Microsoft.AspNetCore.Http;

namespace Elsa.Samples.AspNet.Webhooks.WorkflowServer.Workflows;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace Elsa.Samples.AspNet.WorkflowContexts.Entities;

public class Customer
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Website { get; set; }
public string Id { get; set; } = default!;
public string Name { get; set; } = default!;
public string Email { get; set; } = default!;
public string Phone { get; set; } = default!;
public string Website { get; set; } = default!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\src\bundles\Elsa\Elsa.csproj" />
<ProjectReference Include="..\..\..\src\common\Elsa.Testing.Shared\Elsa.Testing.Shared.csproj" />
<ProjectReference Include="..\..\..\src\common\Elsa.Testing.Shared.Integration\Elsa.Testing.Shared.Integration.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// Build service container.
var serviceProvider = services.BuildServiceProvider();

// Populate registries. This is only necessary for applications that are not using hosted services.
// Populate registries. This is only necessary for applications that are not using hosted services.
await serviceProvider.PopulateRegistriesAsync();

// Import a workflow from a JSON file.
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/Elsa.Server.Web/Elsa.Server.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\modules\Elsa.AzureServiceBus\Elsa.AzureServiceBus.csproj" />
<ProjectReference Include="..\..\modules\Elsa.Caching.Distributed.MassTransit\Elsa.Caching.Distributed.MassTransit.csproj" />
<ProjectReference Include="..\..\modules\Elsa.EntityFrameworkCore.PostgreSql\Elsa.EntityFrameworkCore.PostgreSql.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.MassTransit.AzureServiceBus\Elsa.MassTransit.AzureServiceBus.csproj"/>
Expand All @@ -32,7 +33,6 @@
<ProjectReference Include="..\..\modules\Elsa.MongoDb\Elsa.MongoDb.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.ProtoActor\Elsa.ProtoActor.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.Identity\Elsa.Identity.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.ProtoActor.Cluster.AzureContainerApps\Elsa.ProtoActor.Cluster.AzureContainerApps.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.WorkflowProviders.BlobStorage\Elsa.WorkflowProviders.BlobStorage.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.Hangfire\Elsa.Hangfire.csproj"/>
<ProjectReference Include="..\..\modules\Elsa.Http\Elsa.Http.csproj"/>
Expand Down
4 changes: 0 additions & 4 deletions src/bundles/Elsa.Server.Web/Endpoints/Api1/Get/Endpoint.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Elsa.Abstractions;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Models;
using Elsa.Workflows.Runtime.Contracts;
using Elsa.Workflows.Runtime.Parameters;
using JetBrains.Annotations;

namespace Elsa.Server.Web.Endpoints.Api1.Get;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using Elsa.Abstractions;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Models;
using Elsa.Workflows.Options;
using Elsa.Workflows.Runtime;
using Elsa.Workflows.Runtime.Contracts;
using Elsa.Workflows.Runtime.Options;
using Elsa.Workflows.Runtime.Parameters;

namespace Elsa.Server.Web.Endpoints.DynamicWorkflows.Post;

public class Post(IWorkflowRegistry workflowRegistry, IWorkflowRuntime workflowRuntime) : ElsaEndpointWithoutRequest
public class Post(IWorkflowInvoker workflowInvoker) : ElsaEndpointWithoutRequest
{
public override void Configure()
{
Expand All @@ -31,7 +33,6 @@ public override async Task HandleAsync(CancellationToken ct)
}
};

await workflowRegistry.RegisterAsync(workflow, ct);
await workflowRuntime.StartWorkflowAsync("DynamicWorkflow1", new StartWorkflowRuntimeParams());
await workflowInvoker.InvokeAsync(workflow, cancellationToken: ct);
}
}
8 changes: 8 additions & 0 deletions src/bundles/Elsa.Server.Web/Enums/WorkflowRuntime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Elsa.Server.Web;

public enum WorkflowRuntime
{
Default,
Distributed,
ProtoActor
}
38 changes: 27 additions & 11 deletions src/bundles/Elsa.Server.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Elsa.Workflows;
using Elsa.Workflows.Management.Compression;
using Elsa.Workflows.Management.Stores;
using Elsa.Workflows.Runtime.Distributed.Extensions;
using Elsa.Workflows.Runtime.Stores;
using JetBrains.Annotations;
using Medallion.Threading.FileSystem;
Expand All @@ -39,17 +40,18 @@
const bool usePostgres = false;
const bool useCockroachDb = false;
const bool useDapper = false;
const bool useProtoActor = false;
const bool useHangfire = false;
const bool useQuartz = false;
const bool useQuartz = true;
const bool useMassTransit = true;
const bool useZipCompression = false;
const bool runEFCoreMigrations = true;
const bool useMemoryStores = false;
const bool useCaching = true;
const bool useAzureServiceBusModule = false;
const bool useReadOnlyMode = false;
const WorkflowRuntime workflowRuntime = WorkflowRuntime.ProtoActor;
const DistributedCachingTransport distributedCachingTransport = DistributedCachingTransport.MassTransit;
const MassTransitBroker useMassTransitBroker = MassTransitBroker.RabbitMq;
const MassTransitBroker massTransitBroker = MassTransitBroker.Memory;

var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
Expand All @@ -64,7 +66,7 @@
var azureServiceBusConnectionString = configuration.GetConnectionString("AzureServiceBus")!;
var rabbitMqConnectionString = configuration.GetConnectionString("RabbitMq")!;
var redisConnectionString = configuration.GetConnectionString("Redis")!;
var distributedLockProviderName = configuration.GetSection("Runtime")["DistributedLockProvider"];
var distributedLockProviderName = configuration.GetSection("Runtime:DistributedLocking")["Provider"];
var appRole = Enum.Parse<ApplicationRole>(configuration["AppRole"]);

// Add Elsa services.
Expand Down Expand Up @@ -186,7 +188,12 @@
ef.RunMigrations = runEFCoreMigrations;
});

if (useProtoActor)
if (workflowRuntime == WorkflowRuntime.Distributed)
{
runtime.UseDistributedRuntime();
}

if (workflowRuntime == WorkflowRuntime.ProtoActor)
{
runtime.UseProtoActor(proto => proto.PersistenceProvider = _ =>
{
Expand All @@ -207,12 +214,13 @@
{
runtime.ActivityExecutionLogStore = sp => sp.GetRequiredService<MemoryActivityExecutionStore>();
runtime.WorkflowExecutionLogStore = sp => sp.GetRequiredService<MemoryWorkflowExecutionLogStore>();
runtime.WorkflowInboxStore = sp => sp.GetRequiredService<MemoryWorkflowInboxMessageStore>();
}

if (useCaching)
runtime.UseCache();

runtime.DistributedLockingOptions = options => configuration.GetSection("Runtime:DistributedLocking").Bind(options);

runtime.DistributedLockProvider = _ =>
{
switch (distributedLockProviderName)
Expand Down Expand Up @@ -328,23 +336,23 @@
{
massTransit.DisableConsumers = appRole == ApplicationRole.Api;

if (useMassTransitBroker == MassTransitBroker.AzureServiceBus)
if (massTransitBroker == MassTransitBroker.AzureServiceBus)
{
massTransit.UseAzureServiceBus(azureServiceBusConnectionString, serviceBusFeature => serviceBusFeature.ConfigureServiceBus = bus =>
{
bus.PrefetchCount = 100;
bus.PrefetchCount = 50;
bus.LockDuration = TimeSpan.FromMinutes(5);
bus.MaxConcurrentCalls = 32;
bus.MaxDeliveryCount = 8;
// etc.
});
}

if (useMassTransitBroker == MassTransitBroker.RabbitMq)
if (massTransitBroker == MassTransitBroker.RabbitMq)
{
massTransit.UseRabbitMq(rabbitMqConnectionString, rabbit => rabbit.ConfigureServiceBus = bus =>
{
bus.PrefetchCount = 4;
bus.PrefetchCount = 50;
bus.Durable = true;
bus.AutoDelete = false;
bus.ConcurrentMessageLimit = 32;
Expand All @@ -362,6 +370,14 @@
});
}

if (useAzureServiceBusModule)
{
elsa.UseAzureServiceBus(azureServiceBusConnectionString, asb =>
{
asb.AzureServiceBusOptions = options => configuration.GetSection("AzureServiceBus").Bind(options);
});
}

elsa.InstallDropIns(options => options.DropInRootDirectory = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "DropIns"));
elsa.AddSwagger();
elsa.AddFastEndpointsAssembly<Program>();
Expand Down Expand Up @@ -433,4 +449,4 @@ public partial class Program
/// Set by the test runner to configure the module for testing.
/// </summary>
public static Action<IModule>? ConfigureForTest { get; set; }
}
}
Loading
Loading