Enable workflow instance exporter by default

This commit is contained in:
Sipke Schoorstra 2023-07-13 16:13:09 +02:00
parent e7f844b790
commit dd3bdaa8d7
3 changed files with 4 additions and 3 deletions

View file

@ -32,7 +32,6 @@ services
runtime.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString));
runtime.UseDefaultRuntime(dr => dr.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString)));
runtime.UseExecutionLogRecords(e => e.UseEntityFrameworkCore(ef => ef.UseSqlite(sqliteConnectionString)));
runtime.UseAsyncWorkflowStateExporter();
})
.UseScheduling()
.UseJavaScript()

View file

@ -24,6 +24,5 @@ public class AsyncWorkflowStateExporterFeature : FeatureBase
public override void Configure()
{
Module.Configure<WorkflowRuntimeFeature>(workflowRuntime => workflowRuntime.WorkflowStateExporter = sp => ActivatorUtilities.CreateInstance<AsyncWorkflowStateExporter>(sp));
Services.AddCommandHandler<ExportWorkflowStateToDbCommandHandler, ExportWorkflowStateToDbCommand>();
}
}

View file

@ -74,7 +74,7 @@ public class WorkflowRuntimeFeature : FeatureBase
/// <summary>
/// A factory that instantiates an <see cref="IWorkflowStateExporter"/>.
/// </summary>
public Func<IServiceProvider, IWorkflowStateExporter> WorkflowStateExporter { get; set; } = ActivatorUtilities.GetServiceOrCreateInstance<NoopWorkflowStateExporter>;
public Func<IServiceProvider, IWorkflowStateExporter> WorkflowStateExporter { get; set; } = ActivatorUtilities.GetServiceOrCreateInstance<AsyncWorkflowStateExporter>;
/// <summary>
/// A factory that instantiates an <see cref="ITaskDispatcher"/>.
@ -120,6 +120,9 @@ public class WorkflowRuntimeFeature : FeatureBase
{
// Activities
Module.AddActivitiesFrom<WorkflowRuntimeFeature>();
// Add command handler for export workflow state to database.
Services.AddCommandHandler<ExportWorkflowStateToDbCommandHandler, ExportWorkflowStateToDbCommand>();
}
/// <inheritdoc />