- Introduced `WorkflowStateCommitted` notification to encapsulate workflow execution context, state, and instance details. - Updated `DefaultCommitStateHandler` to publish `WorkflowStateCommitted` via `IMediator`. - Adjusted `DispatchWorkflowExtensions` to use `WorkflowStateCommitted` for workflow completion. Updates KubernetesClient and Microsoft packages (#6917) * Remove Proto.Cluster.Kubernetes dependency due to vulnerability - Temporarily removed `Proto.Cluster.Kubernetes` package and provider integration because of a vulnerability in its dependency (https://avd.aquasec.com/nvd/2025/cve-2025-9708). - Adjusted related cluster provider and remote configuration logic. - Updated `PortAttribute` default parameter for clarity. * Revert "Remove Proto.Cluster.Kubernetes dependency due to vulnerability" This reverts commit 0720d970968e4f7338825407258b34ddffb1d2a4. * Add KubernetesClient package and update MicrosoftVersion to 9.0.9 - Added `KubernetesClient` package to the project dependencies. - Updated `MicrosoftVersion` to `9.0.9` in `Directory.Packages.props`. Update Polly packages - Bump Polly and Polly.Extensions package versions to 8.6.3. Update `Microsoft.AspNetCore.Authorization` to use `MicrosoftVersion` property Ensure Docker images ship CA trust and add TLS smoke tests (#6918) Remove TlsSmoke project and related solution references - Deleted `TlsSmoke` project files (`Program.cs` and `TlsSmoke.csproj`). - Removed `TlsSmoke` project reference from the solution file (`Elsa.sln`). Add comprehensive Copilot coding agent instructions for repository onboarding (#6920) * Initial plan * Add comprehensive .github/copilot-instructions.md with validated build instructions Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com> Add ForEach tests, introduce asynchronous workflow runner and enhance workflow events. (#6926) * Introduce asynchronous workflow runner and enhance workflow events. - Added `AsyncWorkflowRunner` to enable asynchronous workflow execution and result tracking. - Introduced new event arguments, such as `ActivityExecutedEventArgs` and `WorkflowStateCommittedEventArgs`. - Expanded `WorkflowEvents` class to include `ActivityExecuted`, `ActivityExecutedLogUpdated`, and `WorkflowStateCommitted` events. - Refactored event arguments into the `Elsa.Testing.Shared.EventArgs` namespace. - Enhanced tests with `AsyncWorkflowRunner` and new event-driven workflow scenarios. * Refactor event argument classes to unify namespace and simplify inheritance * Add shared component DotSettings file to support namespace exclusions Refactor `WaitAsync` call in `DispatchWorkflowsTests` to remove unnecessary generic type.
38 lines
2.2 KiB
C#
38 lines
2.2 KiB
C#
using Elsa.Mediator.Contracts;
|
|
using Elsa.Workflows.CommitStates;
|
|
using Elsa.Workflows.Management;
|
|
using Elsa.Workflows.Runtime.Entities;
|
|
using Elsa.Workflows.Runtime.Notifications;
|
|
using Elsa.Workflows.Runtime.Requests;
|
|
using Elsa.Workflows.State;
|
|
|
|
namespace Elsa.Workflows.Runtime;
|
|
|
|
public class DefaultCommitStateHandler(
|
|
IWorkflowInstanceManager workflowInstanceManager,
|
|
IBookmarksPersister bookmarkPersister,
|
|
IVariablePersistenceManager variablePersistenceManager,
|
|
IMediator mediator,
|
|
ILogRecordSink<ActivityExecutionRecord> activityExecutionLogRecordSink,
|
|
ILogRecordSink<WorkflowExecutionLogRecord> workflowExecutionLogRecordSink) : ICommitStateHandler
|
|
{
|
|
public async Task CommitAsync(WorkflowExecutionContext workflowExecutionContext, CancellationToken cancellationToken = default)
|
|
{
|
|
var workflowState = workflowInstanceManager.ExtractWorkflowState(workflowExecutionContext);
|
|
await CommitAsync(workflowExecutionContext, workflowState, cancellationToken);
|
|
}
|
|
|
|
public async Task CommitAsync(WorkflowExecutionContext workflowExecutionContext, WorkflowState workflowState, CancellationToken cancellationToken = default)
|
|
{
|
|
var updateBookmarksRequest = new UpdateBookmarksRequest(workflowExecutionContext, workflowExecutionContext.BookmarksDiff, workflowExecutionContext.CorrelationId);
|
|
await bookmarkPersister.PersistBookmarksAsync(updateBookmarksRequest);
|
|
await activityExecutionLogRecordSink.PersistExecutionLogsAsync(workflowExecutionContext, cancellationToken);
|
|
await workflowExecutionLogRecordSink.PersistExecutionLogsAsync(workflowExecutionContext, cancellationToken);
|
|
await variablePersistenceManager.SaveVariablesAsync(workflowExecutionContext);
|
|
var workflowInstance = await workflowInstanceManager.SaveAsync(workflowState, cancellationToken);
|
|
workflowExecutionContext.ExecutionLog.Clear();
|
|
workflowExecutionContext.ClearCompletedActivityExecutionContexts();
|
|
await workflowExecutionContext.ExecuteDeferredTasksAsync();
|
|
await mediator.SendAsync(new WorkflowStateCommitted(workflowExecutionContext, workflowState, workflowInstance), cancellationToken);
|
|
}
|
|
} |