diff --git a/src/core/Elsa.Abstractions/Services/IWorkflowQueue.cs b/src/core/Elsa.Abstractions/Services/IWorkflowQueue.cs
index b05f8132f..4605bc5c9 100644
--- a/src/core/Elsa.Abstractions/Services/IWorkflowQueue.cs
+++ b/src/core/Elsa.Abstractions/Services/IWorkflowQueue.cs
@@ -2,6 +2,7 @@
using System.Threading;
using System.Threading.Tasks;
using Elsa.Bookmarks;
+using Elsa.Builders;
namespace Elsa.Services
{
@@ -18,7 +19,7 @@ namespace Elsa.Services
string? correlationId = default,
string? contextId = default,
CancellationToken cancellationToken = default);
-
+
///
/// Enqueues the specified workflows for execution.
///
@@ -28,12 +29,17 @@ namespace Elsa.Services
string? correlationId = default,
string? contextId = default,
CancellationToken cancellationToken = default);
-
+
///
/// Enqueues the specified workflow instance and activity for execution.
///
Task EnqueueWorkflowInstance(string workflowInstanceId, string activityId, object? input, CancellationToken cancellationToken = default);
-
+
+ ///
+ /// Enqueues the specified workflow definition and activity for execution.
+ ///
+ Task EnqueueWorkflowDefinition(string? tenantId, string activityId, object? input, string? correlationId, string? contextId, CancellationToken cancellationToken) where T : IWorkflow;
+
///
/// Enqueues the specified workflow definition and activity for execution.
///
diff --git a/src/core/Elsa.Core/Services/WorkflowQueue.cs b/src/core/Elsa.Core/Services/WorkflowQueue.cs
index a6acde353..37cd569c2 100644
--- a/src/core/Elsa.Core/Services/WorkflowQueue.cs
+++ b/src/core/Elsa.Core/Services/WorkflowQueue.cs
@@ -2,6 +2,7 @@
using System.Threading;
using System.Threading.Tasks;
using Elsa.Bookmarks;
+using Elsa.Builders;
using Elsa.Messages;
using Open.Linq.AsyncExtensions;
@@ -31,7 +32,7 @@ namespace Elsa.Services
await EnqueueWorkflowsAsync(results, input, correlationId, contextId, cancellationToken);
}
- public async Task EnqueueWorkflowsAsync(IEnumerable results, object? input = default, string? correlationId = default, string? contextId = default, CancellationToken cancellationToken = default)
+ public async Task EnqueueWorkflowsAsync(IEnumerable results, object? input, string? correlationId, string? contextId, CancellationToken cancellationToken)
{
foreach (var result in results)
await EnqueueWorkflowInstance(result.WorkflowInstanceId, result.ActivityId, input, cancellationToken);
@@ -41,8 +42,14 @@ namespace Elsa.Services
{
await _commandSender.SendAsync(new RunWorkflowInstance(workflowInstanceId, activityId, input));
}
+
+ public async Task EnqueueWorkflowDefinition(string? tenantId, string activityId, object? input, string? correlationId, string? contextId, CancellationToken cancellationToken) where T : IWorkflow
+ {
+ var workflowDefinitionId = typeof(T).Name;
+ await EnqueueWorkflowDefinition(workflowDefinitionId, tenantId, activityId, input, correlationId, contextId, cancellationToken);
+ }
- public async Task EnqueueWorkflowDefinition(string workflowDefinitionId, string? tenantId, string activityId, object? input, string? correlationId, string? contextId, CancellationToken cancellationToken = default)
+ public async Task EnqueueWorkflowDefinition(string workflowDefinitionId, string? tenantId, string activityId, object? input, string? correlationId, string? contextId, CancellationToken cancellationToken)
{
await _commandSender.SendAsync(new RunWorkflowDefinition(workflowDefinitionId, tenantId, activityId, input, correlationId, contextId));
}