Skip to content

Commit

Permalink
Merge branch 'v3-token-refresh' into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmskywalker committed Jan 13, 2023
2 parents 096206d + c6ceb24 commit ed0f88c
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 89 deletions.
11 changes: 0 additions & 11 deletions src/modules/Elsa.Elasticsearch/Features/ElasticsearchFeature.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using Elastic.Clients.Elasticsearch;
using Elsa.Elasticsearch.Extensions;
using Elsa.Elasticsearch.HostedServices;
using Elsa.Elasticsearch.Modules.Management;
using Elsa.Elasticsearch.Modules.Runtime;
using Elsa.Elasticsearch.Options;
using Elsa.Elasticsearch.Services;
using Elsa.Features.Abstractions;
using Elsa.Features.Services;
using Elsa.Workflows.Management.Entities;
using Elsa.Workflows.Runtime.Entities;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
Expand All @@ -30,12 +25,6 @@ public ElasticsearchFeature(IModule module) : base(module)
/// </summary>
public Action<ElasticsearchOptions> Options { get; set; } = _ => { };

/// <inheritdoc />
public override void ConfigureHostedServices()
{
Module.ConfigureHostedService<ConfigureAliasesHostedService>(-2);
}

/// <inheritdoc />
public override void Apply()
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public override void Apply()
base.Apply();

AddStore<WorkflowInstance, EFCoreWorkflowInstanceStore>();
AddStore<WorkflowInstance, EFCoreWorkflowInstanceStore>();
AddStore<WorkflowDefinition, EFCoreWorkflowDefinitionStore>();
}
}
11 changes: 0 additions & 11 deletions src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Elsa.Workflows.Runtime.Features;
using Elsa.Workflows.Runtime.Implementations;
using Microsoft.Extensions.DependencyInjection;

namespace Elsa.EntityFrameworkCore.Modules.Runtime;

Expand All @@ -26,13 +24,4 @@ public static ExecutionLogRecordFeature UseEntityFrameworkCore(this ExecutionLog
feature.Module.Configure(configure);
return feature;
}

/// <summary>
/// Configures the workflow runtime to send workflow state to the <see cref="AsyncWorkflowStateExporter"/>.
/// </summary>
public static WorkflowRuntimeFeature UseAsyncWorkflowStateExporter(this WorkflowRuntimeFeature feature)
{
feature.WorkflowStateExporter = sp => ActivatorUtilities.CreateInstance<AsyncWorkflowStateExporter>(sp);
return feature;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Elsa.Workflows.Management.Features;
[DependsOn(typeof(MediatorFeature))]
[DependsOn(typeof(SystemClockFeature))]
[DependsOn(typeof(WorkflowsFeature))]
[DependsOn(typeof(WorkflowDefinitionsFeature))]
public class WorkflowManagementFeature : FeatureBase
{
private const string PrimitivesCategory = "Primitives";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,10 @@ public static WorkflowRuntimeFeature UseExecutionLogRecords(this WorkflowRuntime
feature.Module.Configure(configure);
return feature;
}

public static WorkflowRuntimeFeature UseAsyncWorkflowStateExporter(this WorkflowRuntimeFeature feature, Action<AsyncWorkflowStateExporterFeature>? configure = default)
{
feature.Module.Configure(configure);
return feature;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Elsa.Workflows.Management.Features;
using Elsa.Workflows.Runtime.Implementations;
using Microsoft.Extensions.DependencyInjection;

namespace Elsa.Workflows.Runtime.Features;

/// <summary>
/// Configures and enables <see cref="AsyncWorkflowStateExporter"/>.
/// </summary>
[DependsOn(typeof(WorkflowInstancesFeature))]
public class AsyncWorkflowStateExporterFeature : FeatureBase
{
/// <inheritdoc />
public AsyncWorkflowStateExporterFeature(IModule module) : base(module)
{
}

/// <inheritdoc />
public override void Configure()
{
Module.Configure<WorkflowRuntimeFeature>(workflowRuntime => workflowRuntime.WorkflowStateExporter = sp => ActivatorUtilities.CreateInstance<AsyncWorkflowStateExporter>(sp));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public WorkflowRuntimeFeature(IModule module) : base(module)
/// <summary>
/// A factory that instantiates an <see cref="IWorkflowStateExporter"/>.
/// </summary>
public Func<IServiceProvider, IWorkflowStateExporter> WorkflowStateExporter { get; set; } = sp => sp.GetRequiredService<NoopWorkflowStateExporter>();
public Func<IServiceProvider, IWorkflowStateExporter> WorkflowStateExporter { get; set; } = ActivatorUtilities.GetServiceOrCreateInstance<NoopWorkflowStateExporter>;

/// <summary>
/// A factory that instantiates an <see cref="ITaskDispatcher"/>.
Expand Down Expand Up @@ -145,8 +145,6 @@ public override void Apply()
.AddWorkflowDefinitionProvider<ClrWorkflowDefinitionProvider>()

// Workflow state exporter.
.AddSingleton<NoopWorkflowStateExporter>()
.AddSingleton<AsyncWorkflowStateExporter>()
.AddSingleton(WorkflowStateExporter)

// Domain handlers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
runtime.UseDefaultRuntime(dr => dr.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString)));
runtime.UseExecutionLogRecords(d => d.UseEntityFrameworkCore(ef => ef.UseSqlite()));
runtime.UseExecutionLogRecords(e => e.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString)));
runtime.WorkflowStateExporter = sp => sp.GetRequiredService<AsyncWorkflowStateExporter>();
runtime.UseAsyncWorkflowStateExporter();
})
.UseActivityDefinitions(feature => feature.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString)))
.UseJobs(jobs => jobs.ConfigureOptions = options => options.WorkerCount = 10)
Expand Down

0 comments on commit ed0f88c

Please sign in to comment.