From ff4c721eda39d258cef26531f88cdcfaf859b695 Mon Sep 17 00:00:00 2001 From: master <> Date: Wed, 8 Apr 2026 14:56:02 +0300 Subject: [PATCH] feat: port WorkflowStore plugins (Oracle, Mongo, Postgres) from Serdica Ported 3 database backend plugins with namespace adaptation: - Oracle: EF Core-based store with AQ signaling wiring (2 files) - MongoDB: Delegates to DataStore.MongoDB extension method (2 files) - PostgreSQL: Delegates to DataStore.PostgreSQL extension method (2 files) Implementation files already exist in __Libraries DataStore projects (ported in earlier commits). These plugins are thin IDependencyInjectionRoutine wrappers that enable dynamic plugin loading via the workflow plugin system. Also fleshed out the stub OracleWorkflowDataStoreExtensions to register WorkflowDbContext, OracleWorkflowRuntimeStateStore, and OracleWorkflowHostedJobLockService. All namespaces converted from Ablera.Serdica to StellaOps. Plugin interface adapted from IPluginServiceRegistrator to IDependencyInjectionRoutine. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/Workflow/StellaOps.Workflow.slnx | 5 +++ .../OracleWorkflowDataStoreExtensions.cs | 26 +++++++++-- .../ServiceRegistrator.cs | 16 +++++++ ...Workflow.Plugin.WorkflowStore.Mongo.csproj | 37 +++++++++++++++ .../ServiceRegistrator.cs | 45 +++++++++++++++++++ ...orkflow.Plugin.WorkflowStore.Oracle.csproj | 45 +++++++++++++++++++ .../ServiceRegistrator.cs | 16 +++++++ ...kflow.Plugin.WorkflowStore.Postgres.csproj | 37 +++++++++++++++ 8 files changed, 223 insertions(+), 4 deletions(-) create mode 100644 src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/ServiceRegistrator.cs create mode 100644 src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/StellaOps.Workflow.Plugin.WorkflowStore.Mongo.csproj create mode 100644 src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/ServiceRegistrator.cs create mode 100644 src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/StellaOps.Workflow.Plugin.WorkflowStore.Oracle.csproj create mode 100644 src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/ServiceRegistrator.cs create mode 100644 src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/StellaOps.Workflow.Plugin.WorkflowStore.Postgres.csproj diff --git a/src/Workflow/StellaOps.Workflow.slnx b/src/Workflow/StellaOps.Workflow.slnx index 67e2f4912..008e298d5 100644 --- a/src/Workflow/StellaOps.Workflow.slnx +++ b/src/Workflow/StellaOps.Workflow.slnx @@ -14,6 +14,11 @@ + + + + + diff --git a/src/Workflow/__Libraries/StellaOps.Workflow.DataStore.Oracle/OracleWorkflowDataStoreExtensions.cs b/src/Workflow/__Libraries/StellaOps.Workflow.DataStore.Oracle/OracleWorkflowDataStoreExtensions.cs index c39a268a7..792a310dd 100644 --- a/src/Workflow/__Libraries/StellaOps.Workflow.DataStore.Oracle/OracleWorkflowDataStoreExtensions.cs +++ b/src/Workflow/__Libraries/StellaOps.Workflow.DataStore.Oracle/OracleWorkflowDataStoreExtensions.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.EntityFrameworkCore; using StellaOps.Workflow.Abstractions; @@ -10,10 +11,27 @@ public static class OracleWorkflowDataStoreExtensions public static IServiceCollection AddWorkflowOracleDataStore( this IServiceCollection services, IConfiguration configuration) { - // Register WorkflowDbContext with Oracle provider - // Register OracleWorkflowRuntimeStateStore - // Register OracleWorkflowHostedJobLockService - // Register EF-based projection/retention stores + services.AddWorkflowModule("workflow-store.oracle", "1.0.0"); + services.AddSingleton( + new WorkflowBackendRegistrationMarker(WorkflowBackendNames.Oracle)); + + if (!string.Equals(configuration.GetWorkflowBackendProvider(), WorkflowBackendNames.Oracle, StringComparison.OrdinalIgnoreCase)) + { + return services; + } + + services.AddDbContext(options => + { + var connectionString = configuration.GetConnectionString("WorkflowOracle") + ?? configuration.GetConnectionString("Default"); + if (!string.IsNullOrWhiteSpace(connectionString)) + { + options.UseOracle(connectionString); + } + }); + services.Replace(ServiceDescriptor.Scoped()); + services.Replace(ServiceDescriptor.Scoped()); + return services; } } diff --git a/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/ServiceRegistrator.cs b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/ServiceRegistrator.cs new file mode 100644 index 000000000..024b1e762 --- /dev/null +++ b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/ServiceRegistrator.cs @@ -0,0 +1,16 @@ +using StellaOps.DependencyInjection; +using StellaOps.Workflow.Abstractions; +using StellaOps.Workflow.DataStore.MongoDB; + +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace StellaOps.Workflow.Plugin.WorkflowStore.Mongo; + +public sealed class ServiceRegistrator : IDependencyInjectionRoutine +{ + public IServiceCollection Register(IServiceCollection services, IConfiguration configuration) + { + return services.AddWorkflowMongoDataStore(configuration); + } +} diff --git a/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/StellaOps.Workflow.Plugin.WorkflowStore.Mongo.csproj b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/StellaOps.Workflow.Plugin.WorkflowStore.Mongo.csproj new file mode 100644 index 000000000..84a3614d3 --- /dev/null +++ b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Mongo/StellaOps.Workflow.Plugin.WorkflowStore.Mongo.csproj @@ -0,0 +1,37 @@ + + + net10.0 + false + enable + true + enable + false + true + $([System.IO.Path]::Combine($(MSBuildProjectDirectory),'..','..','StellaOps.Workflow.WebService','PluginBinaries','$(MSBuildProjectName)')) + + + + + + + + + + + + + + + false + runtime + + + false + runtime + + + false + runtime + + + diff --git a/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/ServiceRegistrator.cs b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/ServiceRegistrator.cs new file mode 100644 index 000000000..0e29b71ff --- /dev/null +++ b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/ServiceRegistrator.cs @@ -0,0 +1,45 @@ +using StellaOps.DependencyInjection; +using StellaOps.Workflow.Abstractions; +using StellaOps.Workflow.DataStore.Oracle; +using StellaOps.Workflow.Signaling.OracleAq; + +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace StellaOps.Workflow.Plugin.WorkflowStore.Oracle; + +public sealed class ServiceRegistrator : IDependencyInjectionRoutine +{ + public IServiceCollection Register(IServiceCollection services, IConfiguration configuration) + { + services.AddWorkflowOracleDataStore(configuration); + + if (!string.Equals(configuration.GetWorkflowBackendProvider(), WorkflowBackendNames.Oracle, StringComparison.OrdinalIgnoreCase)) + { + return services; + } + + var useNativeSignalDriver = string.Equals( + configuration.GetWorkflowSignalDriverProvider(), + WorkflowSignalDriverNames.Native, + StringComparison.OrdinalIgnoreCase); + + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.Replace(ServiceDescriptor.Scoped(sp => sp.GetRequiredService())); + services.Replace(ServiceDescriptor.Scoped(sp => sp.GetRequiredService())); + services.Replace(ServiceDescriptor.Scoped(sp => sp.GetRequiredService())); + services.Replace(ServiceDescriptor.Scoped()); + if (useNativeSignalDriver) + { + services.Replace(ServiceDescriptor.Scoped(sp => sp.GetRequiredService())); + } + + services.AddSingleton( + new WorkflowSignalDriverRegistrationMarker(WorkflowSignalDriverNames.Native)); + + return services; + } +} diff --git a/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/StellaOps.Workflow.Plugin.WorkflowStore.Oracle.csproj b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/StellaOps.Workflow.Plugin.WorkflowStore.Oracle.csproj new file mode 100644 index 000000000..4ae46bed2 --- /dev/null +++ b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Oracle/StellaOps.Workflow.Plugin.WorkflowStore.Oracle.csproj @@ -0,0 +1,45 @@ + + + net10.0 + false + enable + true + enable + false + true + $([System.IO.Path]::Combine($(MSBuildProjectDirectory),'..','..','StellaOps.Workflow.WebService','PluginBinaries','$(MSBuildProjectName)')) + + + + + + + + + + + + + + + false + runtime + + + false + runtime + + + false + runtime + + + false + runtime + + + false + runtime + + + diff --git a/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/ServiceRegistrator.cs b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/ServiceRegistrator.cs new file mode 100644 index 000000000..f852fc5b0 --- /dev/null +++ b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/ServiceRegistrator.cs @@ -0,0 +1,16 @@ +using StellaOps.DependencyInjection; +using StellaOps.Workflow.Abstractions; +using StellaOps.Workflow.DataStore.PostgreSQL; + +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace StellaOps.Workflow.Plugin.WorkflowStore.Postgres; + +public sealed class ServiceRegistrator : IDependencyInjectionRoutine +{ + public IServiceCollection Register(IServiceCollection services, IConfiguration configuration) + { + return services.AddWorkflowPostgresDataStore(configuration); + } +} diff --git a/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/StellaOps.Workflow.Plugin.WorkflowStore.Postgres.csproj b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/StellaOps.Workflow.Plugin.WorkflowStore.Postgres.csproj new file mode 100644 index 000000000..8810d0ddc --- /dev/null +++ b/src/Workflow/__Plugins/StellaOps.Workflow.Plugin.WorkflowStore.Postgres/StellaOps.Workflow.Plugin.WorkflowStore.Postgres.csproj @@ -0,0 +1,37 @@ + + + net10.0 + false + enable + true + enable + false + true + $([System.IO.Path]::Combine($(MSBuildProjectDirectory),'..','..','StellaOps.Workflow.WebService','PluginBinaries','$(MSBuildProjectName)')) + + + + + + + + + + + + + + + false + runtime + + + false + runtime + + + false + runtime + + +