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 + + +