diff --git a/src/core/Elsa.Abstractions/Messages/Distributed/RunWorkflow.cs b/src/core/Elsa.Abstractions/Messaging/Distributed/RunWorkflow.cs similarity index 92% rename from src/core/Elsa.Abstractions/Messages/Distributed/RunWorkflow.cs rename to src/core/Elsa.Abstractions/Messaging/Distributed/RunWorkflow.cs index dbae6a95c..a0ddfd536 100644 --- a/src/core/Elsa.Abstractions/Messages/Distributed/RunWorkflow.cs +++ b/src/core/Elsa.Abstractions/Messaging/Distributed/RunWorkflow.cs @@ -1,6 +1,6 @@ using Elsa.Models; -namespace Elsa.Messages.Distributed +namespace Elsa.Messaging.Distributed { public class RunWorkflow { diff --git a/src/core/Elsa.Abstractions/Messages/Domain/ActivityExecuted.cs b/src/core/Elsa.Abstractions/Messaging/Domain/ActivityExecuted.cs similarity index 88% rename from src/core/Elsa.Abstractions/Messages/Domain/ActivityExecuted.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/ActivityExecuted.cs index 38c04544e..e87c9be85 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/ActivityExecuted.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/ActivityExecuted.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { public class ActivityExecuted : ActivityNotification { diff --git a/src/core/Elsa.Abstractions/Messages/Domain/ActivityExecuting.cs b/src/core/Elsa.Abstractions/Messaging/Domain/ActivityExecuting.cs similarity index 88% rename from src/core/Elsa.Abstractions/Messages/Domain/ActivityExecuting.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/ActivityExecuting.cs index 4d942e1d7..79b3b0ffe 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/ActivityExecuting.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/ActivityExecuting.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { public class ActivityExecuting : ActivityNotification { diff --git a/src/core/Elsa.Abstractions/Messages/Domain/ActivityNotification.cs b/src/core/Elsa.Abstractions/Messaging/Domain/ActivityNotification.cs similarity index 94% rename from src/core/Elsa.Abstractions/Messages/Domain/ActivityNotification.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/ActivityNotification.cs index ced19f92c..9100a794a 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/ActivityNotification.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/ActivityNotification.cs @@ -2,7 +2,7 @@ using Elsa.Services.Models; using MediatR; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { public abstract class ActivityNotification : INotification { diff --git a/src/core/Elsa.Abstractions/Messages/Domain/ExecutingWorkflow.cs b/src/core/Elsa.Abstractions/Messaging/Domain/ExecutingWorkflow.cs similarity index 88% rename from src/core/Elsa.Abstractions/Messages/Domain/ExecutingWorkflow.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/ExecutingWorkflow.cs index 5518cb501..6ad9a045e 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/ExecutingWorkflow.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/ExecutingWorkflow.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { public class ExecutingWorkflow : WorkflowNotification { diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowCancelled.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowCancelled.cs similarity index 91% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowCancelled.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowCancelled.cs index 7a5e6d4a3..9b569eda3 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowCancelled.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowCancelled.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Published when a workflow transitioned into the Cancelled state. diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowCompleted.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowCompleted.cs similarity index 91% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowCompleted.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowCompleted.cs index 4229d78a3..d3d2029dd 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowCompleted.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowCompleted.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Published when a workflow transitioned into the Completed state. diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowDefinitionStoreUpdated.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowDefinitionStoreUpdated.cs similarity index 86% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowDefinitionStoreUpdated.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowDefinitionStoreUpdated.cs index 5f4de9a12..7803a4381 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowDefinitionStoreUpdated.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowDefinitionStoreUpdated.cs @@ -1,6 +1,6 @@ using MediatR; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Published when the workflow definition store is updated. diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowExecuted.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowExecuted.cs similarity index 91% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowExecuted.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowExecuted.cs index ba2df1f73..0786c91cd 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowExecuted.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowExecuted.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Published when a burst of execution finished. diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowFaulted.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowFaulted.cs similarity index 91% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowFaulted.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowFaulted.cs index 5f7c5ba08..8bb551ed4 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowFaulted.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowFaulted.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Published when a workflow transitioned into the Faulted state. diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowNotification.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowNotification.cs similarity index 93% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowNotification.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowNotification.cs index 805263dcf..2c0397ad2 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowNotification.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowNotification.cs @@ -1,7 +1,7 @@ using Elsa.Services.Models; using MediatR; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Common base for workflow-related events. diff --git a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowSuspended.cs b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowSuspended.cs similarity index 91% rename from src/core/Elsa.Abstractions/Messages/Domain/WorkflowSuspended.cs rename to src/core/Elsa.Abstractions/Messaging/Domain/WorkflowSuspended.cs index a1dc0baf0..c0f1382a6 100644 --- a/src/core/Elsa.Abstractions/Messages/Domain/WorkflowSuspended.cs +++ b/src/core/Elsa.Abstractions/Messaging/Domain/WorkflowSuspended.cs @@ -1,6 +1,6 @@ using Elsa.Services.Models; -namespace Elsa.Messages.Domain +namespace Elsa.Messaging.Domain { /// /// Published when a workflow transitioned into the Suspended state. diff --git a/src/core/Elsa.Abstractions/Services/Activity.cs b/src/core/Elsa.Abstractions/Services/Activity.cs index 842436c3c..447962847 100644 --- a/src/core/Elsa.Abstractions/Services/Activity.cs +++ b/src/core/Elsa.Abstractions/Services/Activity.cs @@ -21,6 +21,7 @@ namespace Elsa.Services public string? Name { get; set; } public string? DisplayName{ get; set; } public string? Description{ get; set; } + public bool PersistWorkflow { get; set; } public Task CanExecuteAsync(ActivityExecutionContext context, CancellationToken cancellationToken) => OnCanExecuteAsync(context, cancellationToken); public Task ExecuteAsync(ActivityExecutionContext context, CancellationToken cancellationToken) => OnExecuteAsync(context, cancellationToken); diff --git a/src/core/Elsa.Abstractions/Services/IActivity.cs b/src/core/Elsa.Abstractions/Services/IActivity.cs index 25729ae54..14a84f820 100644 --- a/src/core/Elsa.Abstractions/Services/IActivity.cs +++ b/src/core/Elsa.Abstractions/Services/IActivity.cs @@ -37,6 +37,11 @@ namespace Elsa.Services /// Description of this activity. /// string? Description { get; set; } + + /// + /// A value indicating whether the workflow instance will be persisted automatically upon executing this activity. + /// + bool PersistWorkflow { get; set; } /// /// Activity output. diff --git a/src/core/Elsa.Core/Activities/ControlFlow/Join/Join.cs b/src/core/Elsa.Core/Activities/ControlFlow/Join/Join.cs index 889017722..d81aea0e4 100644 --- a/src/core/Elsa.Core/Activities/ControlFlow/Join/Join.cs +++ b/src/core/Elsa.Core/Activities/ControlFlow/Join/Join.cs @@ -5,8 +5,7 @@ using System.Threading.Tasks; using Elsa.Attributes; using Elsa.Design; using Elsa.Extensions; -using Elsa.Messages; -using Elsa.Messages.Domain; +using Elsa.Messaging.Domain; using Elsa.Results; using Elsa.Services; using Elsa.Services.Models; diff --git a/src/core/Elsa.Core/Elsa.Core.csproj b/src/core/Elsa.Core/Elsa.Core.csproj index d877e6a39..f0a2d273d 100644 --- a/src/core/Elsa.Core/Elsa.Core.csproj +++ b/src/core/Elsa.Core/Elsa.Core.csproj @@ -54,7 +54,7 @@ - + \ No newline at end of file diff --git a/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs b/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs index d98dfb930..314a79b2f 100644 --- a/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs +++ b/src/core/Elsa.Core/Extensions/ElsaServiceCollectionExtensions.cs @@ -10,9 +10,9 @@ using Elsa.Caching; using Elsa.Converters; using Elsa.Expressions; using Elsa.Mapping; -using Elsa.Messages; -using Elsa.Messages.Distributed; -using Elsa.Messages.Distributed.Handlers; +using Elsa.Messaging; +using Elsa.Messaging.Distributed; +using Elsa.Messaging.Distributed.Handlers; using Elsa.Persistence; using Elsa.Persistence.Memory; using Elsa.Runtime; diff --git a/src/core/Elsa.Core/Messages/Domain/Handlers/ActivityLoggingWorkflowEventHandler.cs b/src/core/Elsa.Core/Messages/Domain/Handlers/ActivityLoggingWorkflowEventHandler.cs deleted file mode 100644 index dbbf57144..000000000 --- a/src/core/Elsa.Core/Messages/Domain/Handlers/ActivityLoggingWorkflowEventHandler.cs +++ /dev/null @@ -1,33 +0,0 @@ -// using Elsa.Models; -// using Elsa.Services; -// using Elsa.Services.Models; -// using NodaTime; -// -// namespace Elsa.Messages.Handlers -// { -// public class ActivityLoggingWorkflowEventHandler : WorkflowEventHandlerBase -// { -// private readonly IClock clock; -// -// public ActivityLoggingWorkflowEventHandler(IClock clock) -// { -// this.clock = clock; -// } -// -// protected override void ActivityExecuted(ProcessExecutionContext processExecutionContext, IActivity activity) -// { -// var timeStamp = clock.GetCurrentInstant(); -// processExecutionContext.ProcessInstance.ExecutionLog.Add( -// new LogEntry(activity.Id, timeStamp, $"Successfully executed at {timeStamp}")); -// } -// -// protected override void ActivityFaulted( -// ProcessExecutionContext processExecutionContext, -// IActivity activity, -// string message) -// { -// processExecutionContext.ProcessInstance.ExecutionLog.Add( -// new LogEntry(activity.Id, clock.GetCurrentInstant(), message, true)); -// } -// } -// } \ No newline at end of file diff --git a/src/core/Elsa.Core/Messages/Distributed/Handlers/RunWorkflowHandler.cs b/src/core/Elsa.Core/Messaging/Distributed/Handlers/RunWorkflowHandler.cs similarity index 91% rename from src/core/Elsa.Core/Messages/Distributed/Handlers/RunWorkflowHandler.cs rename to src/core/Elsa.Core/Messaging/Distributed/Handlers/RunWorkflowHandler.cs index 9ce782c87..8deef4c9f 100644 --- a/src/core/Elsa.Core/Messages/Distributed/Handlers/RunWorkflowHandler.cs +++ b/src/core/Elsa.Core/Messaging/Distributed/Handlers/RunWorkflowHandler.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Elsa.Services; using Rebus.Handlers; -namespace Elsa.Messages.Distributed.Handlers +namespace Elsa.Messaging.Distributed.Handlers { public class RunWorkflowHandler : IHandleMessages { diff --git a/src/core/Elsa.Core/Messages/Domain/Handlers/PersistenceWorkflowEventHandler.cs b/src/core/Elsa.Core/Messaging/Domain/Handlers/PersistenceWorkflowEventHandler.cs similarity index 95% rename from src/core/Elsa.Core/Messages/Domain/Handlers/PersistenceWorkflowEventHandler.cs rename to src/core/Elsa.Core/Messaging/Domain/Handlers/PersistenceWorkflowEventHandler.cs index 623c97fe8..a15eb9462 100644 --- a/src/core/Elsa.Core/Messages/Domain/Handlers/PersistenceWorkflowEventHandler.cs +++ b/src/core/Elsa.Core/Messaging/Domain/Handlers/PersistenceWorkflowEventHandler.cs @@ -1,4 +1,3 @@ -using System; using System.Threading; using System.Threading.Tasks; using Elsa.Extensions; @@ -8,7 +7,7 @@ using Elsa.Services.Models; using MediatR; using Microsoft.Extensions.Logging; -namespace Elsa.Messages.Domain.Handlers +namespace Elsa.Messaging.Domain.Handlers { public class PersistenceWorkflowEventHandler : INotificationHandler, @@ -39,7 +38,7 @@ namespace Elsa.Messages.Domain.Handlers public async Task Handle(ActivityExecuted notification, CancellationToken cancellationToken) { - if (notification.WorkflowExecutionContext.PersistenceBehavior == WorkflowPersistenceBehavior.ActivityExecuted) + if (notification.WorkflowExecutionContext.PersistenceBehavior == WorkflowPersistenceBehavior.ActivityExecuted || notification.Activity.PersistWorkflow) await SaveWorkflowAsync(notification.WorkflowExecutionContext, cancellationToken); } diff --git a/src/core/Elsa.Core/Messages/Domain/Handlers/WorkflowExecutionLogEventHandler.cs b/src/core/Elsa.Core/Messaging/Domain/Handlers/WorkflowExecutionLogEventHandler.cs similarity index 94% rename from src/core/Elsa.Core/Messages/Domain/Handlers/WorkflowExecutionLogEventHandler.cs rename to src/core/Elsa.Core/Messaging/Domain/Handlers/WorkflowExecutionLogEventHandler.cs index 4b330fd1a..7e3e4db36 100644 --- a/src/core/Elsa.Core/Messages/Domain/Handlers/WorkflowExecutionLogEventHandler.cs +++ b/src/core/Elsa.Core/Messaging/Domain/Handlers/WorkflowExecutionLogEventHandler.cs @@ -4,7 +4,7 @@ using Elsa.Services.Models; using MediatR; using NodaTime; -namespace Elsa.Messages.Domain.Handlers +namespace Elsa.Messaging.Domain.Handlers { public class WorkflowExecutionLogEventHandler : INotificationHandler { diff --git a/src/core/Elsa.Core/Messages/ServiceCollectionExtensions.cs b/src/core/Elsa.Core/Messaging/ServiceCollectionExtensions.cs similarity index 95% rename from src/core/Elsa.Core/Messages/ServiceCollectionExtensions.cs rename to src/core/Elsa.Core/Messaging/ServiceCollectionExtensions.cs index ce774a2f5..620105871 100644 --- a/src/core/Elsa.Core/Messages/ServiceCollectionExtensions.cs +++ b/src/core/Elsa.Core/Messaging/ServiceCollectionExtensions.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Rebus.Config; using Rebus.ServiceProvider; -namespace Elsa.Messages +namespace Elsa.Messaging { public static class ServiceCollectionExtensions { diff --git a/src/core/Elsa.Core/Persistence/PublishingWorkflowDefinitionStore.cs b/src/core/Elsa.Core/Persistence/PublishingWorkflowDefinitionStore.cs index 124ccaf13..7342957c8 100644 --- a/src/core/Elsa.Core/Persistence/PublishingWorkflowDefinitionStore.cs +++ b/src/core/Elsa.Core/Persistence/PublishingWorkflowDefinitionStore.cs @@ -1,8 +1,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Elsa.Messages; -using Elsa.Messages.Domain; +using Elsa.Messaging.Domain; using Elsa.Models; using MediatR; diff --git a/src/core/Elsa.Core/Services/WorkflowHost.cs b/src/core/Elsa.Core/Services/WorkflowHost.cs index 87681d02a..56f2c7b4d 100644 --- a/src/core/Elsa.Core/Services/WorkflowHost.cs +++ b/src/core/Elsa.Core/Services/WorkflowHost.cs @@ -6,8 +6,7 @@ using System.Threading.Tasks; using Elsa.Comparers; using Elsa.Expressions; using Elsa.Extensions; -using Elsa.Messages; -using Elsa.Messages.Domain; +using Elsa.Messaging.Domain; using Elsa.Models; using Elsa.Persistence; using Elsa.Results; diff --git a/src/core/Elsa.Core/Services/WorkflowScheduler.cs b/src/core/Elsa.Core/Services/WorkflowScheduler.cs index 5b4787bd3..68d77aa03 100644 --- a/src/core/Elsa.Core/Services/WorkflowScheduler.cs +++ b/src/core/Elsa.Core/Services/WorkflowScheduler.cs @@ -6,8 +6,8 @@ using System.Threading.Tasks; using Elsa.Comparers; using Elsa.Expressions; using Elsa.Extensions; -using Elsa.Messages.Distributed; -using Elsa.Messages.Domain; +using Elsa.Messaging.Distributed; +using Elsa.Messaging.Domain; using Elsa.Models; using Elsa.Persistence; using Elsa.Services.Models; diff --git a/src/core/Elsa.Core/StartupTasks/StartServiceBusTask.cs b/src/core/Elsa.Core/StartupTasks/StartServiceBusTask.cs index 2f7df8477..08670e2f9 100644 --- a/src/core/Elsa.Core/StartupTasks/StartServiceBusTask.cs +++ b/src/core/Elsa.Core/StartupTasks/StartServiceBusTask.cs @@ -1,6 +1,6 @@ using System.Threading; using System.Threading.Tasks; -using Elsa.Messages.Distributed; +using Elsa.Messaging.Distributed; using Elsa.Runtime; using Rebus.Bus; diff --git a/src/server/Elsa.Server.Host/Startup.cs b/src/server/Elsa.Server.Host/Startup.cs index dcd14bde2..a38286f52 100644 --- a/src/server/Elsa.Server.Host/Startup.cs +++ b/src/server/Elsa.Server.Host/Startup.cs @@ -1,3 +1,4 @@ +using Elsa.Activities.Http.Extensions; using Elsa.Runtime; using Elsa.Server.GraphQL.Extensions; using Elsa.StartupTasks;